Considering a simple test which raises a warning and a pytest.ini file:
import warnings
def test_foo():
warnings.warn(UserWarning('oh no'))
[pytest]
filterwarnings =
error
Running with $ pytest -W ignore still makes the warning an error. I believe this is a bug and command-line options should take precedence over ini-options.
(Follow-up from #3945).
In summary the current precedence order is:
- mark
- ini file
- cmdline option
IMHO this should be instead:
- mark
- cmdline option
- ini
Considering a simple test which raises a warning and a
pytest.inifile:Running with
$ pytest -W ignorestill makes the warning an error. I believe this is a bug and command-line options should take precedence over ini-options.(Follow-up from #3945).
In summary the current precedence order is:
IMHO this should be instead: