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 11
11
from ..compat import MappingMixin
12
12
from ..compat import NOTSET
13
13
from _pytest .outcomes import fail
14
- from _pytest .warning_types import PytestWarning
14
+ from _pytest .warning_types import UnknownMarkWarning
15
15
16
16
EMPTY_PARAMETERSET_OPTION = "empty_parameter_set_mark"
17
17
@@ -294,10 +294,10 @@ def __getattr__(self, name):
294
294
self ._update_markers (name )
295
295
if name not in self ._markers :
296
296
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 ,
301
301
)
302
302
if self ._config .option .strict :
303
303
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):
9
9
"""
10
10
11
11
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
+
12
21
class PytestDeprecationWarning (PytestWarning , DeprecationWarning ):
13
22
"""
14
23
Bases: :class:`pytest.PytestWarning`, :class:`DeprecationWarning`.
Original file line number Diff line number Diff line change @@ -165,15 +165,11 @@ filterwarnings =
165
165
ignore::pytest.PytestExperimentalApiWarning
166
166
# Do not cause SyntaxError for invalid escape sequences in py37.
167
167
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
168
170
pytester_example_dir = testing/example_scripts
169
171
markers =
170
172
issue
171
- nothing
172
- foo
173
- bar
174
- baz
175
- xyz
176
- XYZ
177
173
178
174
[flake8]
179
175
max-line-length = 120
You can’t perform that action at this time.
0 commit comments