From df6dc3c920b42aa44a5bb3086ee7a3b38c2b886e Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sun, 14 Sep 2025 12:42:29 +0100 Subject: [PATCH] Fix compatibility with pytest 8.4 https://github.com/pytest-dev/pytest/pull/12473 removed `_pytestfixturefunction`. The `getfixturemarker` function is still private, but has existed across all pytest versions that we support. Fixes: #33 --- pytest_relaxed/classes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pytest_relaxed/classes.py b/pytest_relaxed/classes.py index 9d6b48a..727d99a 100644 --- a/pytest_relaxed/classes.py +++ b/pytest_relaxed/classes.py @@ -6,6 +6,7 @@ # NOTE: don't see any other way to get access to pytest innards besides using # the underscored name :( +from _pytest.fixtures import getfixturemarker from _pytest.python import PyCollector @@ -27,8 +28,7 @@ def istestfunction(obj, name): "teardown", "teardown_method", ) - # TODO: is this reliable? how about __pytest_wrapped__? - is_fixture = hasattr(obj, "_pytestfixturefunction") + is_fixture = getfixturemarker(obj) is not None return not (is_hidden_name or is_fixture)