-
Notifications
You must be signed in to change notification settings - Fork 232
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
Pass and use original sys.argv to/with workers #388
Conversation
Noticed this with pytest-dev/pytest#4523 - it uses "-c" otherwise. |
hm, this hack is a double edged sword, we should reset that stuff after the config initialization is sorted out correctly |
This also should fix #384 (updated the description to reflect that). |
Changing |
again - this hack is going to be a problem ^^ |
Oh, to me this reads as "Well this is problematic, we should revert this when config is fixed", so I understood it was OK to merge this. Well, then we might as well say that workers don't have access to the same |
actually, probably this patch would make his error appear with |
We could also make "mainargv" available somehow. My use case was getting proper "prog" with the usage information in pytest, and that would at least require to pass through "prog" quite a bit - or set it on |
Would just document that |
Yeah, that might be good enough. |
Hmm I don't know about the |
Ahh OK, that's the "use" bit in the title of the PR. I think this can be postponed to another PR, as it seems quite tricky to get it right, while just making |
@RonnyPfannschmidt How is |
31955ea
to
e4d692c
Compare
Done. |
This gets used e.g. by argparse for the "prog" part. We could explicitly pass it through and/or set it on config._parser.prog, but that is a bit tedious just for this use case, and it looks like "simulating" the main prog here appears to not be that bad of a hack after all.
e4d692c
to
a70dace
Compare
|
||
def test_remote_usage_prog(testdir, request): | ||
if not hasattr(request.config._parser, "prog"): | ||
pytest.skip("prog not available in config parser") |
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.
Requires pytest-dev/pytest#4528.
I suggest to add a new section before/after "Identifying the worker process during a test" in the README. |
This gets used e.g. by argparse for the "prog" part.
We could explicitly pass it through and/or set it on
config._parser.prog, but that is a bit tedious just for this use case,
and it looks like "simulating" the main prog here appears to not be that
bad of a hack after all.
Fixes #358, Fixes #384.