From 434e30424e23ebf963412c2378ed9809792f6b15 Mon Sep 17 00:00:00 2001 From: symonk Date: Tue, 27 Oct 2020 17:50:54 +0000 Subject: [PATCH] Address feedback for converting testdir to pytester --- testing/test_mark.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/testing/test_mark.py b/testing/test_mark.py index bc538fe5d..e0b91f0ce 100644 --- a/testing/test_mark.py +++ b/testing/test_mark.py @@ -184,7 +184,9 @@ def test_mark_on_pseudo_function(pytester: Pytester) -> None: @pytest.mark.parametrize("option_name", ["--strict-markers", "--strict"]) -def test_strict_prohibits_unregistered_markers(pytester: Pytester, option_name) -> None: +def test_strict_prohibits_unregistered_markers( + pytester: Pytester, option_name: str +) -> None: pytester.makepyfile( """ import pytest @@ -572,8 +574,12 @@ class TestFunctional: ) items, rec = pytester.inline_genitems(p) has_own, has_inherited = items - assert has_own.get_closest_marker("c").kwargs == {"location": "function"} # type: ignore[union-attr] - assert has_inherited.get_closest_marker("c").kwargs == {"location": "class"} # type: ignore[union-attr] + has_own_marker = has_own.get_closest_marker("c") + has_inherited_marker = has_inherited.get_closest_marker("c") + assert has_own_marker is not None + assert has_inherited_marker is not None + assert has_own_marker.kwargs == {"location": "function"} + assert has_inherited_marker.kwargs == {"location": "class"} assert has_own.get_closest_marker("missing") is None def test_mark_with_wrong_marker(self, pytester: Pytester) -> None: