From a1b10b552abeec24a859a4596eef530d1c6f46da Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Sun, 9 Oct 2022 20:23:53 +0100 Subject: [PATCH] use getfixturemarker --- src/_pytest/mark/structures.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/_pytest/mark/structures.py b/src/_pytest/mark/structures.py index 32137e8fd..31797f563 100644 --- a/src/_pytest/mark/structures.py +++ b/src/_pytest/mark/structures.py @@ -387,11 +387,14 @@ def store_mark(obj, mark: Mark) -> None: This is used to implement the Mark declarations/decorators correctly. """ assert isinstance(mark, Mark), mark - # Always reassign name to avoid updating pytestmark in a reference that - # was only borrowed. - if hasattr(obj, "_pytestfixturefunction"): + + from ..fixtures import getfixturemarker + + if getfixturemarker(obj) is not None: warnings.warn(MARKED_FIXTURE, stacklevel=2) + # Always reassign name to avoid updating pytestmark in a reference that + # was only borrowed. obj.pytestmark = [*get_unpacked_marks(obj), mark]