-
Notifications
You must be signed in to change notification settings - Fork 234
tests: check that PYTEST_ADDOPTS is not processed twice #478
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
Conversation
689d43d
to
be1114e
Compare
What about this note? I.e. with pytest-xdist it becomes part of the invocation now. |
Instead of unsetting it in pytest-xdist, pytest could also skip the env if invocation params are used (https://github.com/pytest-dev/pytest/blob/8db965c401dd46ff9438dd114b538197d0c31c43/src/_pytest/config/__init__.py#L870-L877). While that seems a bit magical, it might be a good/better solution. |
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.
Thanks!
@nicoddemus |
That's fine, the note is about the fact that
Not sure what you mean, can you please clarify? |
Actually I think I'm completely wrong here, |
I like this, but I think we should investigate parameters layouts We need a alternative to pytest. Main that has the control of all of them at the call site |
This avoids mutating the original list to reflect on InvocationParams, which is supposed to be an immutable snapshot of the state of pytest.main() at the moment of invocation (see pytest-dev/pytest-xdist#478).
This avoids mutating the original list to reflect on InvocationParams, which is supposed to be an immutable snapshot of the state of pytest.main() at the moment of invocation (see pytest-dev/pytest-xdist#478).
OK I figure it out, the problem is that def _preparse(self, args, addopts=True):
if addopts:
env_addopts = os.environ.get("PYTEST_ADDOPTS", "")
if len(env_addopts):
args[:] = (
self._validate_args(shlex.split(env_addopts), "via PYTEST_ADDOPTS")
+ args
) That's why The proper fix is to change |
After pytest-dev/pytest#6008 is merged, I think we should still get your test in, as it tightens it. |
lovely find and fix |
This avoids mutating the original list to reflect on InvocationParams, which is supposed to be an immutable snapshot of the state of pytest.main() at the moment of invocation (see pytest-dev/pytest-xdist#478).
This avoids mutating the original list to reflect on InvocationParams, which is supposed to be an immutable snapshot of the state of pytest.main() at the moment of invocation (see pytest-dev/pytest-xdist#478).
be1114e
to
c3b46c4
Compare
Amended to keep the test only - expected to pass on pytestfeatures only for now. |
c3b46c4
to
6b13550
Compare
Can we perhaps skip the test if |
Yeah, but no hurry I guess. |
6b13550
to
0bb848f
Compare
0bb848f
to
dbaa7a5
Compare
Ref: pytest-dev/pytest#6008 Regressed in 953a3f0, uncovering a bug in pytest.
dbaa7a5
to
af31de6
Compare
Since 953a3f0 options are parsed already, e.g. "-v" from
$PYTEST_ADDOPTS
, and therefore$PYTEST_ADDOPTS
should be unset forchild processes.