Beispiel #1
0
 def test_download_deprecated_spider_arg(self):
     with pytest.warns(ScrapyDeprecationWarning,
                       match="Passing a 'spider' argument to "
                             "ExecutionEngine.download is deprecated"):
         e = ExecutionEngine(get_crawler(TestSpider), lambda _: None)
         spider = TestSpider()
         yield e.open_spider(spider, [])
         e.start()
         e.download(Request("data:,"), spider)
         yield e.close()
Beispiel #2
0
 def test_download_deprecated_spider_arg(self):
     with warnings.catch_warnings(record=True) as warning_list:
         e = ExecutionEngine(get_crawler(TestSpider), lambda _: None)
         spider = TestSpider()
         yield e.open_spider(spider, [])
         e.start()
         e.download(Request("data:,"), spider)
         yield e.close()
         self.assertEqual(warning_list[0].category, ScrapyDeprecationWarning)
         self.assertEqual(
             str(warning_list[0].message),
             "Passing a 'spider' argument to ExecutionEngine.download is deprecated",
         )