Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

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

Pablo Hoffman3cda6817551e
diff --git a/scrapy/utils/testproc.py b/scrapy/utils/testproc.py
index b00f8ae47..22239d82f 100644
--- a/scrapy/utils/testproc.py
+++ b/scrapy/utils/testproc.py
@@ -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):