Example #1
0
 def test_deprecated_schedule(self):
     with pytest.warns(ScrapyDeprecationWarning,
                       match="ExecutionEngine.schedule is deprecated, please use "
                             "ExecutionEngine.crawl or ExecutionEngine.download instead"):
         e = ExecutionEngine(get_crawler(TestSpider), lambda _: None)
         spider = TestSpider()
         yield e.open_spider(spider, [])
         e.start()
         e.schedule(Request("data:,"), spider)
         yield e.close()
Example #2
0
 def test_deprecated_schedule(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.schedule(Request("data:,"), spider)
         yield e.close()
         self.assertEqual(warning_list[0].category, ScrapyDeprecationWarning)
         self.assertEqual(
             str(warning_list[0].message),
             "ExecutionEngine.schedule is deprecated, please use "
             "ExecutionEngine.crawl or ExecutionEngine.download instead",
         )