diff --git a/src/_pytest/mark/structures.py b/src/_pytest/mark/structures.py index 43556f0a4..053297fa2 100644 --- a/src/_pytest/mark/structures.py +++ b/src/_pytest/mark/structures.py @@ -368,11 +368,9 @@ def get_unpacked_marks(obj: object) -> Iterable[Mark]: return normalize_mark_list(mark_list) -def get_mro_marks(cls: type) -> List[Mark]: - if cls is object or cls is None: - return [] - if hasattr(cls, "mro_markers"): - return getattr(cls, "mro_markers") +def get_mro_marks(cls: type): + if cls is object or cls is None or hasattr(cls, "mro_markers"): + return getattr(cls, "mro_markers", []) # markers = list(mark for mark in get_unpacked_marks(cls) if mark.name != "parametrize") markers = list(mark for mark in get_unpacked_marks(cls)) diff --git a/testing/test_mark.py b/testing/test_mark.py index 074cc693e..9eecdb59c 100644 --- a/testing/test_mark.py +++ b/testing/test_mark.py @@ -1129,8 +1129,8 @@ def test_marker_expr_eval_failure_handling(pytester: Pytester, expr) -> None: assert result.ret == ExitCode.USAGE_ERROR -def test_markers_from_multiple_inheritances(pytester: Pytester, request) -> None: - py_file = pytester.makepyfile( +def test_markers_from_multiple_inheritances(pytester: Pytester) -> None: + pytester.makepyfile( """ import pytest @pytest.mark.mark1