Skip to content

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

Fix SpiderLoaderTest on Python 3.10.

Andrey Rakhmatullin983b89ad4f72
diff --git a/tests/test_spiderloader/__init__.py b/tests/test_spiderloader/__init__.py
index 4929f1e3e..8a35e9fd7 100644
--- a/tests/test_spiderloader/__init__.py
+++ b/tests/test_spiderloader/__init__.py
@@ -118,6 +118,11 @@ class SpiderLoaderTest(unittest.TestCase):
settings = Settings({'SPIDER_MODULES': [module],
'SPIDER_LOADER_WARN_ONLY': True})
spider_loader = SpiderLoader.from_settings(settings)
+ if str(w[0].message).startswith("_SixMetaPathImporter"):
+ # needed on 3.10 because of https://github.com/benjaminp/six/issues/349,
+ # at least until all six versions we can import (including botocore.vendored.six)
+ # are updated to 1.16.0+
+ w.pop(0)
self.assertIn("Could not load spiders from module", str(w[0].message))
spiders = spider_loader.list()