-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
type: bugproblem that needs to be addressedproblem that needs to be addressed
Description
The following test:
import warnings, pytest
@pytest.mark.filterwarnings('ignore:whatever')
def test_filter():
warn('whatever')
when run with pytest -W error test.py, passes, as expected.
However, adding the --strict command line option results in:
test.py:3: in <module>
@pytest.mark.filterwarnings('ignore:whatever')
co/py-virtualenv/36dev/lib/python3.6/site-packages/_pytest/mark/structures.py:355: in __getattr__
self._check(name)
co/py-virtualenv/36dev/lib/python3.6/site-packages/_pytest/mark/structures.py:371: in _check
raise AttributeError("%r not a registered marker" % (name,))
E AttributeError: 'filterwarnings' not a registered marker
filterwarnings also does not appear in the output of pytest --markers.
While waiting for this to be fixed, the workaround is to register filterwarnings with your per-project list of valid markers, e.g.:
pytest -o 'markers=filterwarnings' --strict -W error z.py
The above has been confirmed on:
platform linux -- Python 3.6.5, pytest-3.6.3, py-1.5.3, pluggy-0.6.0platform linux -- Python 3.4.3, pytest-3.5.1, py-1.5.3, pluggy-0.6.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type: bugproblem that needs to be addressedproblem that needs to be addressed