diff options
author | Travis Oliphant <oliphant@enthought.com> | 2005-11-16 08:15:19 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2005-11-16 08:15:19 +0000 |
commit | 96853238f9a848100ad9e651bb64c8b2c6d1443e (patch) | |
tree | 0aa226f5406f515aee958afec5412031f0f86776 /scipy/test/testing.py | |
parent | 48971fb6b2b44cf475f06ef5a53d123081f1315c (diff) | |
download | numpy-96853238f9a848100ad9e651bb64c8b2c6d1443e.tar.gz |
Restore inadvertent change to f2py.
Diffstat (limited to 'scipy/test/testing.py')
-rw-r--r-- | scipy/test/testing.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/scipy/test/testing.py b/scipy/test/testing.py index 0c01ab51f..a16fea687 100644 --- a/scipy/test/testing.py +++ b/scipy/test/testing.py @@ -210,6 +210,26 @@ def _get_all_method_names(cls): names.append(n) return names +# for debug build--check for memory leaks during the test. +class _SciPyTextTestResult(unittest._TextTestResult): + def startTest(self, test): + unittest._TextTestResult.startTest(self, test) + if self.showAll: + N = len(sys.getobjects(0)) + self._totnumobj = N + self._totrefcnt = sys.gettotalrefcount() + + def stopTest(self, test): + if self.showAll: + N = len(sys.getobjects(0)) + self.stream.write("objects: %d ===> %d; " % (self._totnumobj, N)) + self.stream.write("refcnts: %d ===> %d\n" % (self._totrefcnt, + sys.gettotalrefcount())) + +class SciPyTextTestRunner(unittest.TextTestRunner): + def _makeResult(self): + return _SciPyTextTestResult(self.stream, self.descriptions, self.verbosity) + __all__.append('ScipyTest') class ScipyTest: """ Scipy tests site manager. @@ -366,6 +386,9 @@ class ScipyTest: suites.extend(self._get_suite_list(sys.modules[package_name], level)) all_tests = unittest.TestSuite(suites) + #if hasattr(sys,'getobjects'): + # runner = SciPyTextTestRunner(verbosity=verbosity) + #else: runner = unittest.TextTestRunner(verbosity=verbosity) # Use the builtin displayhook. If the tests are being run # under IPython (for instance), any doctest test suites will |