[pypy-commit] pypy jit-targets: suport for setup_class and teardown_class

hakanardo noreply at buildbot.pypy.org
Tue Dec 6 08:34:28 CET 2011


Author: Hakan Ardo <hakan at debian.org>
Branch: jit-targets
Changeset: r50200:4c76bc680c2f
Date: 2011-12-06 08:34 +0100
http://bitbucket.org/pypy/pypy/changeset/4c76bc680c2f/

Log:	suport for setup_class and teardown_class

diff --git a/pypy/jit/metainterp/test/test_memmgr.py b/pypy/jit/metainterp/test/test_memmgr.py
--- a/pypy/jit/metainterp/test/test_memmgr.py
+++ b/pypy/jit/metainterp/test/test_memmgr.py
@@ -241,10 +241,17 @@
 if __name__ == '__main__':
     # occurs in the subprocess
     for test in [_TestMemoryManager(), _TestIntegration()]:
-        for name in dir(test):
-            if name.startswith('test_'):
-                print
-                print '-'*79
-                print '----- Now running test', name, '-----'
-                print
-                getattr(test, name)()
+        if hasattr(test, 'setup_class'):
+            test.setup_class()
+        try:
+            for name in dir(test):
+                if name.startswith('test_'):
+                    print
+                    print '-'*79
+                    print '----- Now running test', name, '-----'
+                    print
+                    getattr(test, name)()
+        finally:
+            if hasattr(test, 'teardown_class'):
+                test.teardown_class()
+            


More information about the pypy-commit mailing list