Scrapy, a fast high-level web crawling & scraping framework for Python.
Rename ASYNCIO_SUPPORT to ASYNCIO_ENABLED.
Andrey Rakhmatullin3560123090c1
diff --git a/docs/topics/settings.rst b/docs/topics/settings.rstindex 43f59f7cc..5cbf7450e 100644--- a/docs/topics/settings.rst+++ b/docs/topics/settings.rst@@ -160,9 +160,9 @@ to any particular component. In that case the module of that component will beshown, typically an extension, middleware or pipeline. It also means that thecomponent must be enabled in order for the setting to have any effect.-.. setting:: ASYNCIO_SUPPORT+.. setting:: ASYNCIO_ENABLED-ASYNCIO_SUPPORT+ASYNCIO_ENABLED---------------Default: ``False``diff --git a/scrapy/commands/crawl.py b/scrapy/commands/crawl.pyindex e2e69be49..b50761e4a 100644--- a/scrapy/commands/crawl.py+++ b/scrapy/commands/crawl.py@@ -27,7 +27,7 @@ class Command(ScrapyCommand):def process_options(self, args, opts):ScrapyCommand.process_options(self, args, opts)- if self.settings.getbool('ASYNCIO_SUPPORT'):+ if self.settings.getbool('ASYNCIO_ENABLED'):install_asyncio_reactor()try:opts.spargs = arglist_to_dict(opts.spargs)diff --git a/scrapy/commands/runspider.py b/scrapy/commands/runspider.pyindex ebd4eb620..bfe844eb5 100644--- a/scrapy/commands/runspider.py+++ b/scrapy/commands/runspider.py@@ -51,7 +51,7 @@ class Command(ScrapyCommand):def process_options(self, args, opts):ScrapyCommand.process_options(self, args, opts)- if self.settings.getbool('ASYNCIO_SUPPORT'):+ if self.settings.getbool('ASYNCIO_ENABLED'):install_asyncio_reactor()try:opts.spargs = arglist_to_dict(opts.spargs)diff --git a/scrapy/settings/default_settings.py b/scrapy/settings/default_settings.pyindex c9097bd1f..153b8037a 100644--- a/scrapy/settings/default_settings.py+++ b/scrapy/settings/default_settings.py@@ -19,7 +19,7 @@ from os.path import join, abspath, dirnameAJAXCRAWL_ENABLED = False-ASYNCIO_SUPPORT = False+ASYNCIO_ENABLED = FalseAUTOTHROTTLE_ENABLED = FalseAUTOTHROTTLE_DEBUG = Falsediff --git a/scrapy/utils/log.py b/scrapy/utils/log.pyindex 8c56cfa42..0fe3d1549 100644--- a/scrapy/utils/log.py+++ b/scrapy/utils/log.py@@ -149,11 +149,11 @@ def log_scrapy_info(settings):{'versions': ", ".join("%s %s" % (name, version)for name, version in scrapy_components_versions()if name != "Scrapy")})- if settings.getbool('ASYNCIO_SUPPORT'):+ if settings.getbool('ASYNCIO_ENABLED'):if is_asyncio_reactor_installed():logger.debug("Asyncio support enabled")else:- logger.error("ASYNCIO_SUPPORT is on but the Twisted asyncio "+ logger.error("ASYNCIO_ENABLED is on but the Twisted asyncio ""reactor is not installed, this is not supported ""and asyncio coroutines will not work.")diff --git a/tests/test_commands.py b/tests/test_commands.pyindex 3b64bfa23..197d80217 100644--- a/tests/test_commands.py+++ b/tests/test_commands.py@@ -295,12 +295,12 @@ class BadSpider(scrapy.Spider):self.assertIn("start_requests", log)self.assertIn("badspider.py", log)- def test_asyncio_support_true(self):- log = self.get_log(self.debug_log_spider, args=['-s', 'ASYNCIO_SUPPORT=True'])+ def test_asyncio_enabled_true(self):+ log = self.get_log(self.debug_log_spider, args=['-s', 'ASYNCIO_ENABLED=True'])self.assertIn("DEBUG: Asyncio support enabled", log)- def test_asyncio_support_false(self):- log = self.get_log(self.debug_log_spider, args=['-s', 'ASYNCIO_SUPPORT=False'])+ def test_asyncio_enabled_false(self):+ log = self.get_log(self.debug_log_spider, args=['-s', 'ASYNCIO_ENABLED=False'])self.assertNotIn("DEBUG: Asyncio support enabled", log)diff --git a/tests/test_crawler.py b/tests/test_crawler.pyindex 9410b0e7a..05909d995 100644--- a/tests/test_crawler.py+++ b/tests/test_crawler.py@@ -262,19 +262,19 @@ class CrawlerRunnerHasSpider(unittest.TestCase):self.assertEqual(runner.bootstrap_failed, True)@defer.inlineCallbacks- def test_crawler_process_asyncio_supported_true(self):+ def test_crawler_process_asyncio_enabled_true(self):with LogCapture(level=logging.DEBUG) as log:- runner = CrawlerProcess(settings={'ASYNCIO_SUPPORT': True})+ runner = CrawlerProcess(settings={'ASYNCIO_ENABLED': True})yield runner.crawl(NoRequestsSpider)if self.reactor_pytest == 'asyncio':self.assertIn("Asyncio support enabled", str(log))else:self.assertNotIn("Asyncio support enabled", str(log))- self.assertIn("ASYNCIO_SUPPORT is on but the Twisted asyncio reactor is not installed", str(log))+ self.assertIn("ASYNCIO_ENABLED is on but the Twisted asyncio reactor is not installed", str(log))@defer.inlineCallbacks- def test_crawler_process_asyncio_supported_false(self):- runner = CrawlerProcess(settings={'ASYNCIO_SUPPORT': False})+ def test_crawler_process_asyncio_enabled_false(self):+ runner = CrawlerProcess(settings={'ASYNCIO_ENABLED': False})with LogCapture(level=logging.DEBUG) as log:yield runner.crawl(NoRequestsSpider)self.assertNotIn("Asyncio support enabled", str(log))