Add extra command line parameters to Pytest - conftest - getoption



examples/pytest/py1/conftest.py
def pytest_addoption(parser):
    parser.addoption("--demo")
    parser.addoption("--noisy", action='store_true')

examples/pytest/py1/test_one.py
def test_me(request):
    print(request.config.getoption("--demo"))
    print(request.config.getoption("--noisy"))

pytest -s
None
False


pytest -s --demo Hello --noisy
Hello
True