diff --git a/changelog/5928.bugfix.rst b/changelog/5928.bugfix.rst new file mode 100644 index 00000000000..fbc53757d84 --- /dev/null +++ b/changelog/5928.bugfix.rst @@ -0,0 +1 @@ +Report ``PytestUnknownMarkWarning`` at the level of the user's code, not ``pytest``'s. diff --git a/src/_pytest/mark/structures.py b/src/_pytest/mark/structures.py index 2cab96d675a..4d5f706a259 100644 --- a/src/_pytest/mark/structures.py +++ b/src/_pytest/mark/structures.py @@ -323,6 +323,7 @@ def __getattr__(self, name: str) -> MarkDecorator: "custom marks to avoid this warning - for details, see " "https://docs.pytest.org/en/latest/mark.html" % name, PytestUnknownMarkWarning, + 2, ) return MarkDecorator(Mark(name, (), {}))