pytest-dev / pytest

The pytest framework makes it easy to write small tests, yet scales to support complex functional testing
https://pytest.org
MIT License
12.01k stars 2.67k forks source link

Allow disabling of additive options #2036

Open jaraco opened 7 years ago

jaraco commented 7 years ago

Best I can tell, there's no way to suppress the running of doctests. If --doctest-modules is indicated in the pytest.ini (or similar), the only way to disable those tests for a particular run is to edit the file to remove that option (and then of course remember later to undo that change before making other commits to the code).

Better would be for all opt-in options such as --doctest-modules to have an equivalent opt-out option to override the setting from a broader scope, allowing a command-line invocation to supersede the standard test process.

I could imagine a few ways this could be accomplished, but unless prompted, I'll defer to the sensibilities of the maintainers as to how this should be accomplished in pytest.

jaraco commented 7 years ago

Other options that appear to be additive but have no subtractive equivalent:

There may be others.

RonnyPfannschmidt commented 7 years ago

note that currently we use arg-parse, so it would have to be done either manually or layered on top

personally i'd just like to get rid of arg-parse, because it has unreasonable bugs that cant be worked around (like prefix matching that picks the wrong argument/option in face of a incomplete parser)

but its so damn expensive in terms of time and ensuring compatibility that its just left as is