File tree Expand file tree Collapse file tree 3 files changed +16
-11
lines changed Expand file tree Collapse file tree 3 files changed +16
-11
lines changed Original file line number Diff line number Diff line change 1111from ..compat import MappingMixin
1212from ..compat import NOTSET
1313from _pytest .outcomes import fail
14- from _pytest .warning_types import PytestWarning
14+ from _pytest .warning_types import UnknownMarkWarning
1515
1616EMPTY_PARAMETERSET_OPTION = "empty_parameter_set_mark"
1717
@@ -294,10 +294,10 @@ def __getattr__(self, name):
294294 self ._update_markers (name )
295295 if name not in self ._markers :
296296 warnings .warn (
297- "Unknown mark %r. You can register custom marks to avoid this "
298- "warning, without risking typos that break your tests. See "
299- "https://docs.pytest.org/en/latest/mark.html for details. " % name ,
300- PytestWarning ,
297+ "Unknown pytest. mark.%s - is this a typo? You can register "
298+ "custom marks to avoid this warning - for details, see "
299+ "https://docs.pytest.org/en/latest/mark.html" % name ,
300+ UnknownMarkWarning ,
301301 )
302302 if self ._config .option .strict :
303303 fail ("{!r} not a registered marker" .format (name ), pytrace = False )
Original file line number Diff line number Diff line change @@ -9,6 +9,15 @@ class PytestWarning(UserWarning):
99 """
1010
1111
12+ class UnknownMarkWarning (PytestWarning ):
13+ """
14+ Bases: :class:`PytestWarning`.
15+
16+ Warning emitted on use of unknown markers.
17+ See https://docs.pytest.org/en/latest/mark.html for details.
18+ """
19+
20+
1221class PytestDeprecationWarning (PytestWarning , DeprecationWarning ):
1322 """
1423 Bases: :class:`pytest.PytestWarning`, :class:`DeprecationWarning`.
Original file line number Diff line number Diff line change @@ -165,15 +165,11 @@ filterwarnings =
165165 ignore::pytest.PytestExperimentalApiWarning
166166 # Do not cause SyntaxError for invalid escape sequences in py37.
167167 default:invalid escape sequence:DeprecationWarning
168+ # ignore use of unregistered marks, because we use many to test the implementation
169+ ignore::_pytest.warning_types.UnknownMarkWarning
168170pytester_example_dir = testing/example_scripts
169171markers =
170172 issue
171- nothing
172- foo
173- bar
174- baz
175- xyz
176- XYZ
177173
178174[flake8]
179175max-line-length = 120
You can’t perform that action at this time.
0 commit comments