[pypy-svn] r32871 - pypy/dist/pypy/objspace/test

auc at codespeak.net auc at codespeak.net
Wed Oct 4 15:31:00 CEST 2006


Author: auc
Date: Wed Oct  4 15:30:53 2006
New Revision: 32871

Modified:
   pypy/dist/pypy/objspace/test/_test_logic_build.py
Log:
a more generic tester


Modified: pypy/dist/pypy/objspace/test/_test_logic_build.py
==============================================================================
--- pypy/dist/pypy/objspace/test/_test_logic_build.py	(original)
+++ pypy/dist/pypy/objspace/test/_test_logic_build.py	Wed Oct  4 15:30:53 2006
@@ -1,4 +1,3 @@
-import test_logicobjspace as tlo
 import inspect
 
 def raises(exception, call, *args):
@@ -10,23 +9,19 @@
         pass
     return False
 
-
 class Skip(Exception): pass
 
 def skip(desc):
     print "skipping because", desc
     raise Skip
 
-tlo.raises = raises
-tlo.skip = skip
-
-
-classes = [tlo.AppTest_Logic,
-           tlo.AppTest_LogicFutures,
-           tlo.AppTest_CompSpace]
+def run_tests(tm):
+    classes = [obj for name, obj in inspect.getmembers(tm)
+               if isinstance(obj, type)]
 
+    tm.raises = raises
+    tm.skip = skip
 
-def run_tests():
     successes = []
     failures = []
     skipped = []
@@ -46,7 +41,7 @@
             else:
                 successes.append(name)
 
-    if len(successes):
+    if successes:
         print "Successes :"
         print '', '\n '.join(successes)
         print
@@ -59,5 +54,7 @@
         print "Skipped"
         print '', '\n '.join(skipped)
         
-if __name__ == '__main__':
-    run_tests()
+if __name__ == __name__:
+    import sys
+    tm = __import__(sys.argv[1])
+    run_tests(tm)



More information about the Pypy-commit mailing list