Skip to content

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

Do not use self.assertRaises() as context manager

Paul Tremberth9cfe9ae09890
diff --git a/tests/test_spiderloader/__init__.py b/tests/test_spiderloader/__init__.py
index 99a61daea..1cd59b99a 100644
--- a/tests/test_spiderloader/__init__.py
+++ b/tests/test_spiderloader/__init__.py
@@ -95,8 +95,7 @@ class SpiderLoaderTest(unittest.TestCase):
module = 'tests.test_spiderloader.test_spiders.doesnotexist'
settings = Settings({'SPIDER_MODULES': [module]})
- with self.assertRaises(ImportError):
- SpiderLoader.from_settings(settings)
+ self.assertRaises(ImportError, SpiderLoader.from_settings, settings)
def test_bad_spider_modules_warning(self):