From e7284b7dce238afd23c17ede4a6acb5a919ee1ba Mon Sep 17 00:00:00 2001 From: David Keijser Date: Sat, 30 Nov 2013 20:30:45 +0100 Subject: [PATCH] force run of gc in weak ref test case pypy is not using reference counting and thus the weakref will not trigger an error immediately unless a garbage collector run is done explicitly. --- tests/test_weak.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_weak.py b/tests/test_weak.py index 89e90fa..f081f67 100644 --- a/tests/test_weak.py +++ b/tests/test_weak.py @@ -1,9 +1,11 @@ +import gc from smoke import weak, Disconnect from tests.matchers import assert_raises from hamcrest import assert_that, equal_to, instance_of class Dummy(object): + value = None def spam(self): return self.value @@ -20,6 +22,7 @@ def test_weak_raises_disconnect(): d = Dummy() w = weak(d.spam) del d + gc.collect() with assert_raises(instance_of(Disconnect)): r = w()