-
Notifications
You must be signed in to change notification settings - Fork 160
Do not inject plan environment into test environment #4455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: test-invocation-checks-moved
Are you sure you want to change the base?
Do not inject plan environment into test environment #4455
Conversation
9642993 to
8b5a98b
Compare
9f1638e to
5cf11be
Compare
5cf11be to
6ab53e0
Compare
8b5a98b to
d291881
Compare
This will present the same environment to all users of test invocation, from checks to test itself and its results. It was also not clear who is responsible for the environment and its composition, now when it's part of the invocation, all `execute` plugins should see the same content.
It is no longer merged into test environment. That leaves the test environment untainted and with its original content. The plan environment is then exposed to test when invoked, as any other environment component. Related to #4241.
6ab53e0 to
f553a7c
Compare
| def environment(self) -> Environment: | ||
| if self._environment is None: | ||
| # narrow type | ||
| parent = cast(Execute, self.phase.parent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the cast here if we are doing the assert isinstance?
| assert self.phase.parent.plan.my_run is not None | ||
| # narrow type | ||
| run = cast(tmt.base.Run, parent.plan.my_run) | ||
| assert run is not None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you could squeeze in a type annotation of the Plan, that could avoid the cast here too.
It is no longer merged into test environment. That leaves the test environment untainted and with its original content. The plan environment is then exposed to test when invoked, as any other environment component.
Related to #4241.
Pull Request Checklist