From 6b9f5ded0fde24def716e14cf00d91335309e610 Mon Sep 17 00:00:00 2001 From: Efraimov Oren Date: Sun, 10 Oct 2021 17:44:53 +0300 Subject: [PATCH] fix #4 --- src/_pytest/mark/structures.py | 8 +++----- testing/test_mark.py | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) 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