[py-svn] r38212 - py/trunk/py/test/rsession

hpk at codespeak.net hpk at codespeak.net
Thu Feb 8 23:14:03 CET 2007


Author: hpk
Date: Thu Feb  8 23:13:59 2007
New Revision: 38212

Modified:
   py/trunk/py/test/rsession/box.py
Log:
have each boxed test run use its own tempdir


Modified: py/trunk/py/test/rsession/box.py
==============================================================================
--- py/trunk/py/test/rsession/box.py	(original)
+++ py/trunk/py/test/rsession/box.py	Thu Feb  8 23:13:59 2007
@@ -7,6 +7,7 @@
 import os
 import sys
 import marshal
+from py.__.test import config as pytestconfig
 
 PYTESTSTDOUT = "pyteststdout"
 PYTESTSTDERR = "pyteststderr"
@@ -30,6 +31,7 @@
         self.kwargs = kwargs
     
     def run(self, continuation=False):
+        # XXX we should not use py.test.ensuretemp here
         tempdir = py.test.ensuretemp("box%d" % self.count)
         self.count += 1
         self.tempdir = tempdir
@@ -78,6 +80,11 @@
         try:
             if nice_level:
                 os.nice(nice_level)
+            # with fork() we have duplicated py.test's basetemp
+            # directory so we unset it manually here. 
+            # this may be expensive for some test setups, 
+            # but that is what you get with boxing. 
+            pytestconfig.basetemp = None 
             retval = self.fun(*self.args, **self.kwargs)
             retvalf.write(marshal.dumps(retval))
         finally:



More information about the pytest-commit mailing list