-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Error with own 'conf' argument with 'tests/ANY' value #2077
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
Comments
Thanks for the detailed report! It seems your option is being swallowed by pytest's import pytest
def test_params():
print('confcutdir', pytest.config.option.confcutdir)
Could be a bug in import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--confcutdir', dest="confcutdir", default=None,
metavar="dir",
help="only load conftest.py's relative to specified dir.")
parser.add_argument("--conf", type=str,
default="tests/file.ini",
help="use config file")
args = parser.parse_args()
print('conf=', args.conf)
print('confcutdir=', args.confcutdir)
|
It seems it is related to the fact that
If I change your def pytest_addoption(parser):
assert 0
... You will see the hook is not called when we pass
So the problem is that your option is being interpreted as But that's strange, I think changing the |
thus is a duplicate |
Thanks @RonnyPfannschmidt. Option parsing aside, by setting |
yes, that one should be a new issue/pr |
Hi,
there is problem/bug, when i create own
--conf
argument, and i set to this argument value, starts withtests/ANY
value.I attached simple example of tests directory. There is
conftest.py
, when I define two own tests options. One--conf
and one--konf
. All arguments have default valuetests/file.ini
. When I use this arguments from command line, all work, but--conf tests/anyfile
not. If the value string starts with absolute path, all work, onlytests/X
do the problem.My environment is:
~$ pip list
:tests/conftest.py
tests/test_pytest.py
The text was updated successfully, but these errors were encountered: