The test below reproduces the problem: ```python import weakref class Obj: pass ref = None def test1(): obj = Obj() global ref ref = weakref.ref(obj) assert 0 def test2(): assert ref() is None ``` This fails with: ``` ================================== FAILURES =================================== ____________________________________ test1 ____________________________________ def test1(): obj = Obj() global ref ref = weakref.ref(obj) > assert 0 E assert 0 test_foo.py:15: AssertionError ____________________________________ test2 ____________________________________ def test2(): > assert ref() is None E assert <test_foo.Obj object at 0x0000017302911198> is None E + where <test_foo.Obj object at 0x0000017302911198> = ref() test_foo.py:19: AssertionError ========================== 2 failed in 0.04 seconds =========================== ``` The reference to `test1`'s frame should not have leaked. If we comment the `assert 0` line, then both tests pass. xref: pytest-dev/pytest-qt#187
Activity
Add a test for exception leakage described in pytest-dev#187
Clear sys.last_* attributes before running an item
Add acceptance test for pytest-dev#2798
Add changelog entry for pytest-dev#2798
Add changelog entry for pytest-dev#2798
Add a test for exception leakage described in pytest-dev#187