I want to disable capture by default in a pytest plugin I'm working on. This can be done using an "ini" file normally as below:
[pytest] addopts = -s In the pytest docs they discuss "addini", and this works for other values I've tried but not addopts.
An alternative way to approach is to override the argument directly like so:
def pytest_addoption(parser): parser.addoption( "--capture", dest="capture", help="Capture the output", default='no' ) ...but this complains that there is an argument conflict with the existing capture argument.
Is there some other better practice for default values of addopts that I haven't thought of?
Related questions 16 How to specify more than one option in pytest config [pytest_addoption] 1 adding parameters to pytest setup function 2 pytest programmatically change pytest.ini default Related questions 16 How to specify more than one option in pytest config [pytest_addoption] 1 adding parameters to pytest setup function 2 pytest programmatically change pytest.ini default 2 Problems with pytest's addoptions and dynamically parametrizing test fixtures 27 Pytest not recognizing added options 2 Can I add ini style configuration to pytest suites? 0 Where can I find the details of pytest hook spec (for e.g., pytest_addoption) - supported parameters, default values, etc.? 2 Way to add pytest options outside top level conftest? 7 Using pytest_addoptions in a non-root conftest.py 2 pytest - How can I pass pytest addoption value to pytest parameterize? Load 7 more related questions Show fewer related questions
Reset to default