From 307a371499204cccc669a1e21991513c7c6faec7 Mon Sep 17 00:00:00 2001 From: Hudson Cooper Date: Wed, 25 Sep 2024 12:14:06 -0700 Subject: [PATCH] xfail because reference cycles are hard --- tests/unit/test_decorator.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/unit/test_decorator.py b/tests/unit/test_decorator.py index 011256a25..873846de2 100644 --- a/tests/unit/test_decorator.py +++ b/tests/unit/test_decorator.py @@ -439,6 +439,16 @@ def test_deleting_instance_lets_method_be_garbage_collected(self): assert meth_ref() is None + def test_deleting_instance_does_not_break_method(self): + # Reference to method but not instance + method = self.MyClass().cached_method + gc.collect() + try: + method() + except ReferenceError: + pytest.xfail(reason="This test is expected to fail due to the way weakrefs are handled in Python.") + + class TestSignature: def test_function_signature(self): def func(a, b=1, *, c, d=2):