Browse Source

Always run gc before leak test

pull/1813/head
Armin Ronacher 9 years ago
parent
commit
883cb7cedc
  1. 3
      tests/test_regression.py

3
tests/test_regression.py

@ -39,8 +39,7 @@ class assert_no_leak(object):
self.old_objects = len(gc.get_objects()) self.old_objects = len(gc.get_objects())
def __exit__(self, exc_type, exc_value, tb): def __exit__(self, exc_type, exc_value, tb):
if not hasattr(sys, 'getrefcount'): gc.collect()
gc.collect()
new_objects = len(gc.get_objects()) new_objects = len(gc.get_objects())
if new_objects > self.old_objects: if new_objects > self.old_objects:
pytest.fail('Example code leaked') pytest.fail('Example code leaked')

Loading…
Cancel
Save