[pypy-svn] r75113 - pypy/trunk/lib-python

hpk at codespeak.net hpk at codespeak.net
Fri Jun 4 17:45:19 CEST 2010

Author: hpk
Date: Fri Jun  4 17:45:17 2010
New Revision: 75113

try to redo the fix related to testing in lib-python. 
Tests are now collected more "normally" in their respective
directories 2.5.2/test and modified-2.5.2/test instead of "faking"
an artifical tree at lib-python level. 

Note that you will get a collection error if you run a specific test via
"py.ttest lib-python/2.5.2/test/test_XYZ.py" if there is a test_XYZ in
the modified-2.5.2 directory.  

Running "py.test lib-python" or "py.test --pypy=pypy-c lib-python" will
run both modified and unmodified tests as is to be expected and filenames
during testing progress clearly indicate where a test comes from. 

Modified: pypy/trunk/lib-python/conftest.py
--- pypy/trunk/lib-python/conftest.py	(original)
+++ pypy/trunk/lib-python/conftest.py	Fri Jun  4 17:45:17 2010
@@ -520,11 +520,14 @@
         return cache.get(name, None)
     def collect(self): 
+        we_are_in_modified = self.fspath == modregrtestdir
         l = []
-        for x in testmap:
+        for x in self.fspath.listdir():
             name = x.basename
             regrtest = self.get(name)
-            if regrtest is not None: 
+            if regrtest is not None:
+                if bool(we_are_in_modified) ^ regrtest.ismodified():
+                    continue
                 #if option.extracttests:  
                 #    l.append(InterceptedRunModule(name, self, regrtest))
@@ -532,7 +535,14 @@
         return l 
 def pytest_collect_directory(parent, path):
-    return RegrDirectory(path, parent)
+    # use RegrDirectory collector for both modified and unmodified tests
+    if path in (modregrtestdir, regrtestdir):
+        return RegrDirectory(path, parent)
+def pytest_ignore_collect(path):
+    # ignore all files - only RegrDirectory generates tests in lib-python
+    if path.check(file=1):
+        return True
 class RunFileExternal(py.test.collect.File):
     def __init__(self, name, parent, regrtest): 

More information about the Pypy-commit mailing list