-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Py.test improperly handles command line options with spaces #1471
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A sample script:
A sample command that fails:
Where
/Users/svasilyev/parent
is a parent dir for the sample scripts dir (they are in /Users/svasilyev/parent/pytest-cmdline-sample).The error happens only when
../111/env.xml
actually exists, and it is outside of the current dir withconftest.py
&pytest.ini
.The error does NOT happen when:
--capture no
notation).py.test --env ./env.xml --capture=no mytest.py
.py.test --capture=no --env ../111/env.xml mytest.py
(surprise!)--junit-xml ../111/junit.xml
)I guess the error is caused by py.test's cmdline pre-parsing and rootdir detection: it treats the standalone cmdline option
../111/env.xml
as a reference to a test file, and this is done before--env
is actually added to the parser by the plugins.I understand that plugins cannot be properly loaded before the cmdline is pre-parsed, and thus it is impossible to add all cmdline options before cmdline parsing.
Yet, python's
argparse
accepts both--opt=val
and--opt val
notations, so this is the expected behaviour. So, probably, preparsing or rootdir detection should be done a bit more carefully.PS:
The text was updated successfully, but these errors were encountered: