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:
parent
1d726063d6
commit
3cda681755
@ -7,6 +7,7 @@ class ProcessTest(object):
|
|||||||
|
|
||||||
command = None
|
command = None
|
||||||
prefix = [sys.executable, '-m', 'scrapy.cmdline']
|
prefix = [sys.executable, '-m', 'scrapy.cmdline']
|
||||||
|
cwd = os.getcwd() # trial chdirs to temp dir
|
||||||
|
|
||||||
def execute(self, args, check_code=True, settings='missing'):
|
def execute(self, args, check_code=True, settings='missing'):
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
@ -14,7 +15,7 @@ class ProcessTest(object):
|
|||||||
cmd = self.prefix + [self.command] + list(args)
|
cmd = self.prefix + [self.command] + list(args)
|
||||||
pp = TestProcessProtocol()
|
pp = TestProcessProtocol()
|
||||||
pp.deferred.addBoth(self._process_finished, cmd, check_code)
|
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
|
return pp.deferred
|
||||||
|
|
||||||
def _process_finished(self, pp, cmd, check_code):
|
def _process_finished(self, pp, cmd, check_code):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user