Skip to content

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

Merge remote-tracking branch 'origin/master' into crawler-process-reactor-later

Andrey Rakhmatullin3577c005694b
diff --cc tests/test_crawler.py
index e7d5c8132,7bc4fba40..8f6227109
--- a/tests/test_crawler.py
+++ b/tests/test_crawler.py
@@@ -4,9 -4,9 +4,8 @@@ import platfor
import subprocess
import sys
import warnings
- from unittest import skipIf
from pytest import raises, mark
-from testfixtures import LogCapture
from twisted import version as twisted_version
from twisted.internet import defer
from twisted.python.versions import Version
@@@ -360,30 -372,6 +350,21 @@@ class CrawlerProcessSubprocess(ScriptRu
self.assertIn("Spider closed (finished)", log)
self.assertIn("Using reactor: twisted.internet.asyncioreactor.AsyncioSelectorReactor", log)
- # https://twistedmatrix.com/trac/ticket/9766
- @skipIf(platform.system() == 'Windows' and sys.version_info >= (3, 8),
- "the asyncio reactor is broken on Windows when running Python ≥ 3.8")
+ def test_reactor_asyncio_custom_settings(self):
+ log = self.run_script("twisted_reactor_custom_settings.py")
+ self.assertIn("Spider closed (finished)", log)
+ self.assertIn("Using reactor: twisted.internet.asyncioreactor.AsyncioSelectorReactor", log)
+
- # https://twistedmatrix.com/trac/ticket/9766
- @skipIf(platform.system() == 'Windows' and sys.version_info >= (3, 8),
- "the asyncio reactor is broken on Windows when running Python ≥ 3.8")
+ def test_reactor_asyncio_custom_settings_same(self):
+ log = self.run_script("twisted_reactor_custom_settings_same.py")
+ self.assertIn("Spider closed (finished)", log)
+ self.assertIn("Using reactor: twisted.internet.asyncioreactor.AsyncioSelectorReactor", log)
+
- # https://twistedmatrix.com/trac/ticket/9766
- @skipIf(platform.system() == 'Windows' and sys.version_info >= (3, 8),
- "the asyncio reactor is broken on Windows when running Python ≥ 3.8")
+ def test_reactor_asyncio_custom_settings_conflict(self):
+ log = self.run_script("twisted_reactor_custom_settings_conflict.py")
+ self.assertIn("Using reactor: twisted.internet.selectreactor.SelectReactor", log)
+ self.assertIn("(twisted.internet.selectreactor.SelectReactor) does not match the requested one", log)
+
@mark.skipif(sys.implementation.name == 'pypy', reason='uvloop does not support pypy properly')
@mark.skipif(platform.system() == 'Windows', reason='uvloop does not support Windows')
@mark.skipif(twisted_version == Version('twisted', 21, 2, 0), reason='https://twistedmatrix.com/trac/ticket/10106')