This commit is contained in:
Efraimov Oren 2021-10-10 17:44:53 +03:00
parent 40b8855cc4
commit 6b9f5ded0f
2 changed files with 5 additions and 7 deletions

View File

@ -368,11 +368,9 @@ def get_unpacked_marks(obj: object) -> Iterable[Mark]:
return normalize_mark_list(mark_list) return normalize_mark_list(mark_list)
def get_mro_marks(cls: type) -> List[Mark]: def get_mro_marks(cls: type):
if cls is object or cls is None: if cls is object or cls is None or hasattr(cls, "mro_markers"):
return [] return getattr(cls, "mro_markers", [])
if 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) if mark.name != "parametrize")
markers = list(mark for mark in get_unpacked_marks(cls)) markers = list(mark for mark in get_unpacked_marks(cls))

View File

@ -1129,8 +1129,8 @@ def test_marker_expr_eval_failure_handling(pytester: Pytester, expr) -> None:
assert result.ret == ExitCode.USAGE_ERROR assert result.ret == ExitCode.USAGE_ERROR
def test_markers_from_multiple_inheritances(pytester: Pytester, request) -> None: def test_markers_from_multiple_inheritances(pytester: Pytester) -> None:
py_file = pytester.makepyfile( pytester.makepyfile(
""" """
import pytest import pytest
@pytest.mark.mark1 @pytest.mark.mark1