Skip to content

Commit 8532e99

Browse files
committed
Publish UnknownMarkWarning as part of the public API and docs
1 parent ebc0cea commit 8532e99

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed

doc/en/warnings.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,3 +420,5 @@ The following warning types ares used by pytest and are part of the public API:
420420
.. autoclass:: pytest.RemovedInPytest4Warning
421421

422422
.. autoclass:: pytest.PytestExperimentalApiWarning
423+
424+
.. autoclass:: pytest.PytestUnknownMarkWarning

src/_pytest/mark/structures.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from ..compat import NOTSET
1313
from _pytest.deprecated import PYTEST_PARAM_UNKNOWN_KWARGS
1414
from _pytest.outcomes import fail
15-
from _pytest.warning_types import UnknownMarkWarning
15+
from _pytest.warning_types import PytestUnknownMarkWarning
1616

1717
EMPTY_PARAMETERSET_OPTION = "empty_parameter_set_mark"
1818

@@ -318,7 +318,7 @@ def __getattr__(self, name):
318318
"Unknown pytest.mark.%s - is this a typo? You can register "
319319
"custom marks to avoid this warning - for details, see "
320320
"https://docs.pytest.org/en/latest/mark.html" % name,
321-
UnknownMarkWarning,
321+
PytestUnknownMarkWarning,
322322
)
323323

324324
return MarkDecorator(Mark(name, (), {}))

src/_pytest/warning_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class PytestWarning(UserWarning):
99
"""
1010

1111

12-
class UnknownMarkWarning(PytestWarning):
12+
class PytestUnknownMarkWarning(PytestWarning):
1313
"""
1414
Bases: :class:`PytestWarning`.
1515

src/pytest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
from _pytest.recwarn import warns
3838
from _pytest.warning_types import PytestDeprecationWarning
3939
from _pytest.warning_types import PytestExperimentalApiWarning
40+
from _pytest.warning_types import PytestUnknownMarkWarning
4041
from _pytest.warning_types import PytestWarning
4142
from _pytest.warning_types import RemovedInPytest4Warning
4243

@@ -72,6 +73,7 @@
7273
"raises",
7374
"register_assert_rewrite",
7475
"RemovedInPytest4Warning",
76+
"PytestUnknownMarkWarning",
7577
"Session",
7678
"set_trace",
7779
"skip",

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ filterwarnings =
169169
# Do not cause SyntaxError for invalid escape sequences in py37.
170170
default:invalid escape sequence:DeprecationWarning
171171
# ignore use of unregistered marks, because we use many to test the implementation
172-
ignore::_pytest.warning_types.UnknownMarkWarning
172+
ignore::_pytest.warning_types.PytestUnknownMarkWarning
173173
pytester_example_dir = testing/example_scripts
174174
markers =
175175
issue

0 commit comments

Comments
 (0)