[pypy-commit] pypy default: make test_load_error more resilient by improving the leak detection
pjenvey
noreply at buildbot.pypy.org
Tue Mar 18 19:37:42 CET 2014
Author: Philip Jenvey <pjenvey at underboss.org>
Branch:
Changeset: r70059:f777d0ca3f24
Date: 2014-03-18 11:36 -0700
http://bitbucket.org/pypy/pypy/changeset/f777d0ca3f24/
Log: make test_load_error more resilient by improving the leak detection
diff --git a/pypy/module/cpyext/test/test_cpyext.py b/pypy/module/cpyext/test/test_cpyext.py
--- a/pypy/module/cpyext/test/test_cpyext.py
+++ b/pypy/module/cpyext/test/test_cpyext.py
@@ -183,6 +183,19 @@
from rpython.rlib.clibffi import get_libc_name
cls.w_libc = cls.space.wrap(get_libc_name())
+ def setup_method(self, meth):
+ freeze_refcnts(self)
+
+ def teardown_method(self, meth):
+ self.cleanup_references(self.space)
+ # XXX: like AppTestCpythonExtensionBase.teardown_method:
+ # find out how to disable check_and_print_leaks() if the
+ # test failed
+ assert not self.check_and_print_leaks(), (
+ "Test leaks or loses object(s). You should also check if "
+ "the test actually passed in the first place; if it failed "
+ "it is likely to reach this place.")
+
def test_load_error(self):
import cpyext
raises(ImportError, cpyext.load_module, "missing.file", "foo")
@@ -358,13 +371,12 @@
for name in self.imported_module_names:
self.unimport_module(name)
self.cleanup_references(self.space)
- if self.check_and_print_leaks():
- assert False, (
- "Test leaks or loses object(s). You should also check if "
- "the test actually passed in the first place; if it failed "
- "it is likely to reach this place.")
- # XXX find out how to disable check_and_print_leaks() if the
- # XXX test failed...
+ # XXX: find out how to disable check_and_print_leaks() if the
+ # test failed...
+ assert not self.check_and_print_leaks(), (
+ "Test leaks or loses object(s). You should also check if "
+ "the test actually passed in the first place; if it failed "
+ "it is likely to reach this place.")
class AppTestCpythonExtension(AppTestCpythonExtensionBase):
More information about the pypy-commit
mailing list