[pypy-svn] rev 2504 - pypy/trunk/src/pypy/tool

sschwarzer at codespeak.net sschwarzer at codespeak.net
Thu Dec 18 15:35:59 CET 2003


Author: sschwarzer
Date: Thu Dec 18 15:35:59 2003
New Revision: 2504

Modified:
   pypy/trunk/src/pypy/tool/newtest.py
Log:
Add filter function to omit the self test modules of this new unit test
framework.


Modified: pypy/trunk/src/pypy/tool/newtest.py
==============================================================================
--- pypy/trunk/src/pypy/tool/newtest.py	(original)
+++ pypy/trunk/src/pypy/tool/newtest.py	Thu Dec 18 15:35:59 2003
@@ -8,9 +8,8 @@
 import vpath
 
 #TODO
-# - add support for ignored/skipped tests
+# - add support for ignored tests
 # - support TestItem.run with different object spaces
-# - find out why some modules can't be loaded
 
 class TestStatus:
     def __init__(self, name, longstring, shortstring):
@@ -209,7 +208,8 @@
                     module = self._module_from_modpath(modpath)
                     items = self._items_from_module(module)
                 except:
-                    print "skipping testfile (failed loading it)", modpath
+                    print >> sys.stderr, \
+                          "Warning: can't load module %s" % modpath
                 else:
                     self.items.extend(items)
 
@@ -222,10 +222,14 @@
             yield result
 
 
-def main():
-    #filterfunc = lambda m: m.find("pypy.tool.testdata.") == -1
+def main(ignore_selftest=True):
+    # ignore dummy unit tests
+    if ignore_selftest:
+        filterfunc = lambda m: m.find("pypy.tool.testdata.") == -1
+    else:
+        filterfunc = lambda m: True
     ts = TestSuite()
-    ts.initfromdir(autopath.pypydir)
+    ts.initfromdir(autopath.pypydir, filterfunc=filterfunc)
     for res in ts.testresults():
         if res.status == SUCCESS:
             continue


More information about the Pypy-commit mailing list