Discussion on using custom parameters in pytest.main() #11857
-
I have a runtime parameter ./tests/conftest.py: def pytest_addoption(parser):
parser.addoption("--use_https", action="store", dest="use_https", default="0", help="use_https: use HTTPS?") I can run tests using the following two methods in CMD.
But in
In daily use, I found that you can use spaces to separate the flag and value in |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This is expected behavior The form without the equal sign must use 2 strings, one for the options name and one for the value What you did is the equivalent of Use |
Beta Was this translation helpful? Give feedback.
This is expected behavior
The form without the equal sign must use 2 strings, one for the options name and one for the value
What you did is the equivalent of
pytest "--my-option 0"
Use
pytest.main(['--use_https', '0'])