Add a New "Addopts" by Default in Pytest Plugin?
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...
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?