1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-02-23 13:44:25 +00:00

utils.testproc: make spawned process use the original CWD, instead of the temporary one created by twisted trial

This commit is contained in:
Pablo Hoffman 2010-11-29 09:56:14 -02:00
parent 1d726063d6
commit 3cda681755

View File

@ -7,6 +7,7 @@ class ProcessTest(object):
command = None
prefix = [sys.executable, '-m', 'scrapy.cmdline']
cwd = os.getcwd() # trial chdirs to temp dir
def execute(self, args, check_code=True, settings='missing'):
env = os.environ.copy()
@ -14,7 +15,7 @@ class ProcessTest(object):
cmd = self.prefix + [self.command] + list(args)
pp = TestProcessProtocol()
pp.deferred.addBoth(self._process_finished, cmd, check_code)
reactor.spawnProcess(pp, cmd[0], cmd, env=env)
reactor.spawnProcess(pp, cmd[0], cmd, env=env, path=self.cwd)
return pp.deferred
def _process_finished(self, pp, cmd, check_code):