From 0f37c632ac2f22a232cc877877d0fdce59f53f15 Mon Sep 17 00:00:00 2001 From: hpk Date: Thu, 8 Feb 2007 23:13:59 +0100 Subject: [PATCH] [svn r38212] have each boxed test run use its own tempdir --HG-- branch : trunk --- py/test/rsession/box.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/py/test/rsession/box.py b/py/test/rsession/box.py index e58431514..b10ca95d7 100644 --- a/py/test/rsession/box.py +++ b/py/test/rsession/box.py @@ -7,6 +7,7 @@ import py import os import sys import marshal +from py.__.test import config as pytestconfig PYTESTSTDOUT = "pyteststdout" PYTESTSTDERR = "pyteststderr" @@ -30,6 +31,7 @@ class FileBox(object): 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 @@ class FileBox(object): 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: