You can optionally specify many command line options with the pytest_addoption hook.
In the pytest protocol documentation :
Parameters: parser. To add command line options, call parser.addoption (...). To add ini values ββto a file, call parser.addini (...).
The pytest_addoption hook pytest_addoption passed to the parser . You can add as many command line options as you want by calling parser.addoption(...) as many times as you want.
So, an example of adding two parameters is as simple as:
def pytest_addoption(parser): parser.addoption('--foo', action='store_true', help='Do foo') parser.addoption('--bar', action='store_false', help='Do not do bar')
And, like any other hook.test, you need to go to the conftest.py file.
source share