Scrapy, a fast high-level web crawling & scraping framework for Python.
fixed CrawlerProcess when settings are passed as dicts
Mikhail Korobovaa6a72707daa
diff --git a/scrapy/crawler.py b/scrapy/crawler.pyindex 9b35b3642..2cd658276 100644--- a/scrapy/crawler.py+++ b/scrapy/crawler.py@@ -209,8 +209,8 @@ class CrawlerProcess(CrawlerRunner):def __init__(self, settings):super(CrawlerProcess, self).__init__(settings)install_shutdown_handlers(self._signal_shutdown)- configure_logging(settings)- log_scrapy_info(settings)+ configure_logging(self.settings)+ log_scrapy_info(self.settings)def _signal_shutdown(self, signum, _):install_shutdown_handlers(self._signal_kill)diff --git a/tests/test_crawler.py b/tests/test_crawler.pyindex 906573887..53f517c27 100644--- a/tests/test_crawler.py+++ b/tests/test_crawler.py@@ -1,7 +1,7 @@import warningsimport unittest-from scrapy.crawler import Crawler, CrawlerRunner+from scrapy.crawler import Crawler, CrawlerRunner, CrawlerProcessfrom scrapy.settings import Settings, default_settingsfrom scrapy.spiderloader import SpiderLoaderfrom scrapy.utils.spider import DefaultSpider@@ -104,3 +104,13 @@ class CrawlerRunnerTestCase(unittest.TestCase):self.assertEqual(len(w), 1)self.assertIn('Please use SPIDER_LOADER_CLASS', str(w[0].message))++class CrawlerProcessTest(unittest.TestCase):+ def test_crawler_process_accepts_dict(self):+ runner = CrawlerProcess({'foo': 'bar'})+ self.assertEqual(runner.settings['foo'], 'bar')+ self.assertEqual(+ runner.settings['RETRY_ENABLED'],+ default_settings.RETRY_ENABLED+ )+ self.assertIsInstance(runner.settings, Settings)