Rename ASYNCIO_SUPPORT to ASYNCIO_ENABLED.

This commit is contained in:
Andrey Rakhmatullin 2019-12-05 19:06:51 +05:00
parent 352ddbb336
commit 3560123090
7 changed files with 16 additions and 16 deletions

View File

@ -160,9 +160,9 @@ to any particular component. In that case the module of that component will be
shown, typically an extension, middleware or pipeline. It also means that the
component must be enabled in order for the setting to have any effect.
.. setting:: ASYNCIO_SUPPORT
.. setting:: ASYNCIO_ENABLED
ASYNCIO_SUPPORT
ASYNCIO_ENABLED
---------------
Default: ``False``

View File

@ -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)

View File

@ -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)

View File

@ -19,7 +19,7 @@ from os.path import join, abspath, dirname
AJAXCRAWL_ENABLED = False
ASYNCIO_SUPPORT = False
ASYNCIO_ENABLED = False
AUTOTHROTTLE_ENABLED = False
AUTOTHROTTLE_DEBUG = False

View File

@ -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.")

View File

@ -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)

View File

@ -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))