[py-svn] r62210 - in py/branch/pytestplugin/py: misc/testing test test/plugin

hpk at codespeak.net hpk at codespeak.net
Fri Feb 27 10:54:30 CET 2009


Author: hpk
Date: Fri Feb 27 10:54:29 2009
New Revision: 62210

Modified:
   py/branch/pytestplugin/py/misc/testing/test_cache.py
   py/branch/pytestplugin/py/test/config.py
   py/branch/pytestplugin/py/test/plugin/pytest_restdoc.py
Log:
some fixes for making "-n 3" pass


Modified: py/branch/pytestplugin/py/misc/testing/test_cache.py
==============================================================================
--- py/branch/pytestplugin/py/misc/testing/test_cache.py	(original)
+++ py/branch/pytestplugin/py/misc/testing/test_cache.py	Fri Feb 27 10:54:29 2009
@@ -52,7 +52,7 @@
 
 
 class TestAging(BasicCacheAPITest):
-    maxsecs = 0.02
+    maxsecs = 0.10
     cache = AgingCache(maxentries=128, maxseconds=maxsecs)
 
     def test_cache_eviction(self):

Modified: py/branch/pytestplugin/py/test/config.py
==============================================================================
--- py/branch/pytestplugin/py/test/config.py	(original)
+++ py/branch/pytestplugin/py/test/config.py	Fri Feb 27 10:54:29 2009
@@ -57,7 +57,6 @@
         self._conftest.setinitial(args) 
         self.pytestplugins.consider_env()
         self.pytestplugins.do_addoption(self._parser)
-        args = [str(x) for x in args]
         args = self._parser.parse_setoption(args, self.option)
         if not args:
             args.append(py.std.os.getcwd())

Modified: py/branch/pytestplugin/py/test/plugin/pytest_restdoc.py
==============================================================================
--- py/branch/pytestplugin/py/test/plugin/pytest_restdoc.py	(original)
+++ py/branch/pytestplugin/py/test/plugin/pytest_restdoc.py	Fri Feb 27 10:54:29 2009
@@ -15,21 +15,23 @@
 
     def pytest_collect_file(self, path, parent):
         if path.ext == ".txt":
-            project = self._getproject(path)
+            project = getproject(path)
             if project is not None:
-                return ReSTFile(project, path, parent=parent)
-
-    def _getproject(self, path):
-        for parent in path.parts(reverse=True):
-            confrest = parent.join("confrest.py")
-            if confrest.check():
-                Project = confrest.pyimport().Project
-                return Project(parent.dirpath())
+                return ReSTFile(path, parent=parent, project=project)
 
+def getproject(path):
+    for parent in path.parts(reverse=True):
+        confrest = parent.join("confrest.py")
+        if confrest.check():
+            Project = confrest.pyimport().Project
+            return Project(parent.dirpath())
 
 class ReSTFile(py.test.collect.File):
-    def __init__(self, project, fspath, parent):
+    def __init__(self, fspath, parent, project=None):
         super(ReSTFile, self).__init__(fspath=fspath, parent=parent)
+        if project is None:
+            project = getproject(fspath)
+            assert project is not None
         self.project = project
 
     def collect(self):



More information about the pytest-commit mailing list