Scrapy, a fast high-level web crawling & scraping framework for Python.
make sure the mockserver forked from tests uses the current installation of scrapy, not the system one
Pablo Hoffman14e7121674f0
diff --git a/scrapy/tests/test_crawl.py b/scrapy/tests/test_crawl.pyindex cc27903ee..8125ae17e 100644--- a/scrapy/tests/test_crawl.py+++ b/scrapy/tests/test_crawl.py@@ -5,7 +5,7 @@ from subprocess import Popen, PIPEfrom scrapy.spider import BaseSpiderfrom scrapy.http import Requestfrom scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor-from scrapy.utils.test import get_crawler+from scrapy.utils.test import get_crawler, get_testenvclass FollowAllSpider(BaseSpider):@@ -52,7 +52,8 @@ def docrawl(spider, settings=None):class CrawlTestCase(TestCase):def setUp(self):- self.proc = Popen([sys.executable, '-u', '-m', 'scrapy.tests.mockserver'], stdout=PIPE)+ self.proc = Popen([sys.executable, '-u', '-m', 'scrapy.tests.mockserver'],+ stdout=PIPE, env=get_testenv())self.proc.stdout.readline()def tearDown(self):diff --git a/scrapy/utils/test.py b/scrapy/utils/test.pyindex 2def768fe..66e045919 100644--- a/scrapy/utils/test.py+++ b/scrapy/utils/test.py@@ -67,6 +67,14 @@ def get_pythonpath():scrapy_path = __import__('scrapy').__path__[0]return os.path.dirname(scrapy_path) + sep + os.environ.get('PYTHONPATH', '')+def get_testenv():+ """Return a OS environment dict suitable to fork processes that need to import+ this installation of Scrapy, instead of a system installed one.+ """+ env = os.environ.copy()+ env['PYTHONPATH'] = get_pythonpath()+ return env+def assert_samelines(testcase, text1, text2, msg=None):"""Asserts text1 and text2 have the same lines, ignoring differences inline endings between platforms