[svn r38212] have each boxed test run use its own tempdir
--HG-- branch : trunk
This commit is contained in:
		
							parent
							
								
									dcf4e564ad
								
							
						
					
					
						commit
						0f37c632ac
					
				|  | @ -7,6 +7,7 @@ import py | ||||||
| import os | import os | ||||||
| import sys | import sys | ||||||
| import marshal | import marshal | ||||||
|  | from py.__.test import config as pytestconfig | ||||||
| 
 | 
 | ||||||
| PYTESTSTDOUT = "pyteststdout" | PYTESTSTDOUT = "pyteststdout" | ||||||
| PYTESTSTDERR = "pyteststderr" | PYTESTSTDERR = "pyteststderr" | ||||||
|  | @ -30,6 +31,7 @@ class FileBox(object): | ||||||
|         self.kwargs = kwargs |         self.kwargs = kwargs | ||||||
|      |      | ||||||
|     def run(self, continuation=False): |     def run(self, continuation=False): | ||||||
|  |         # XXX we should not use py.test.ensuretemp here | ||||||
|         tempdir = py.test.ensuretemp("box%d" % self.count) |         tempdir = py.test.ensuretemp("box%d" % self.count) | ||||||
|         self.count += 1 |         self.count += 1 | ||||||
|         self.tempdir = tempdir |         self.tempdir = tempdir | ||||||
|  | @ -78,6 +80,11 @@ class FileBox(object): | ||||||
|         try: |         try: | ||||||
|             if nice_level: |             if nice_level: | ||||||
|                 os.nice(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) |             retval = self.fun(*self.args, **self.kwargs) | ||||||
|             retvalf.write(marshal.dumps(retval)) |             retvalf.write(marshal.dumps(retval)) | ||||||
|         finally: |         finally: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue