14
0
forked from pool/python-Scrapy
Files
python-Scrapy/zope-exception-test_crawler.patch

29 lines
1.2 KiB
Diff
Raw Normal View History

Index: Scrapy-2.0.1/tests/test_crawler.py
===================================================================
--- Scrapy-2.0.1.orig/tests/test_crawler.py
+++ Scrapy-2.0.1/tests/test_crawler.py
@@ -20,6 +20,8 @@ from scrapy.extensions.throttle import A
from scrapy.extensions import telnet
from scrapy.utils.test import get_testenv
+from zope.interface.exceptions import MultipleInvalid
+
class BaseCrawlerTest(unittest.TestCase):
@@ -157,11 +159,9 @@ class CrawlerRunnerTestCase(BaseCrawlerT
settings = Settings({
'SPIDER_LOADER_CLASS': 'tests.test_crawler.SpiderLoaderWithWrongInterface'
})
- with warnings.catch_warnings(record=True) as w:
- self.assertRaises(AttributeError, CrawlerRunner, settings)
- self.assertEqual(len(w), 1)
- self.assertIn("SPIDER_LOADER_CLASS", str(w[0].message))
- self.assertIn("scrapy.interfaces.ISpiderLoader", str(w[0].message))
+ msg = "SpiderLoaderWithWrongInterface.*scrapy.interfaces.ISpiderLoader"
+ with self.assertRaisesRegex(MultipleInvalid, msg):
+ CrawlerRunner(settings)
def test_crawler_runner_accepts_dict(self):
runner = CrawlerRunner({'foo': 'bar'})