Author: Philip Jenvey <pjen...@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): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit