diff --git a/testing/python/fixture.py b/testing/python/fixture.py index 023a40d84..6d2bb663b 100644 --- a/testing/python/fixture.py +++ b/testing/python/fixture.py @@ -630,7 +630,7 @@ class TestRequestBasic(object): """ import sys import pytest - from _pytest.compat import safe_str + from _pytest.fixtures import PseudoFixtureDef import gc @pytest.fixture(autouse=True) @@ -647,7 +647,7 @@ class TestRequestBasic(object): gc.collect() leaked_types = sum(1 for _ in gc.garbage - if 'PseudoFixtureDef' in safe_str(_)) + if isinstance(_, PseudoFixtureDef)) gc.garbage[:] = []