Publish UnknownMarkWarning as part of the public API and docs

This commit is contained in:
Bruno Oliveira 2019-04-28 10:06:01 -03:00
parent ebc0cea226
commit 8532e991a5
5 changed files with 8 additions and 4 deletions

View File

@ -420,3 +420,5 @@ The following warning types ares used by pytest and are part of the public API:
.. autoclass:: pytest.RemovedInPytest4Warning
.. autoclass:: pytest.PytestExperimentalApiWarning
.. autoclass:: pytest.PytestUnknownMarkWarning

View File

@ -12,7 +12,7 @@ from ..compat import MappingMixin
from ..compat import NOTSET
from _pytest.deprecated import PYTEST_PARAM_UNKNOWN_KWARGS
from _pytest.outcomes import fail
from _pytest.warning_types import UnknownMarkWarning
from _pytest.warning_types import PytestUnknownMarkWarning
EMPTY_PARAMETERSET_OPTION = "empty_parameter_set_mark"
@ -318,7 +318,7 @@ class MarkGenerator(object):
"Unknown pytest.mark.%s - is this a typo? You can register "
"custom marks to avoid this warning - for details, see "
"https://docs.pytest.org/en/latest/mark.html" % name,
UnknownMarkWarning,
PytestUnknownMarkWarning,
)
return MarkDecorator(Mark(name, (), {}))

View File

@ -9,7 +9,7 @@ class PytestWarning(UserWarning):
"""
class UnknownMarkWarning(PytestWarning):
class PytestUnknownMarkWarning(PytestWarning):
"""
Bases: :class:`PytestWarning`.

View File

@ -37,6 +37,7 @@ from _pytest.recwarn import deprecated_call
from _pytest.recwarn import warns
from _pytest.warning_types import PytestDeprecationWarning
from _pytest.warning_types import PytestExperimentalApiWarning
from _pytest.warning_types import PytestUnknownMarkWarning
from _pytest.warning_types import PytestWarning
from _pytest.warning_types import RemovedInPytest4Warning
@ -72,6 +73,7 @@ __all__ = [
"raises",
"register_assert_rewrite",
"RemovedInPytest4Warning",
"PytestUnknownMarkWarning",
"Session",
"set_trace",
"skip",

View File

@ -169,7 +169,7 @@ filterwarnings =
# Do not cause SyntaxError for invalid escape sequences in py37.
default:invalid escape sequence:DeprecationWarning
# ignore use of unregistered marks, because we use many to test the implementation
ignore::_pytest.warning_types.UnknownMarkWarning
ignore::_pytest.warning_types.PytestUnknownMarkWarning
pytester_example_dir = testing/example_scripts
markers =
issue