Skip to content

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

Add a test.

Andrey Rakhmatullinb39d2d4353d9
diff --git a/tests/test_crawler.py b/tests/test_crawler.py
index 4c5c48e6d..067934961 100644
--- a/tests/test_crawler.py
+++ b/tests/test_crawler.py
@@ -6,6 +6,7 @@ import sys
import warnings
from pathlib import Path
+import pytest
from packaging.version import parse as parse_version
from pytest import mark, raises
from twisted.internet import defer
@@ -67,6 +68,16 @@ class CrawlerTestCase(BaseCrawlerTest):
with raises(ValueError):
Crawler(DefaultSpider())
+ @defer.inlineCallbacks
+ def test_crawler_crawl_twice_deprecated(self):
+ crawler = Crawler(NoRequestsSpider)
+ yield crawler.crawl()
+ with pytest.warns(
+ ScrapyDeprecationWarning,
+ match=r"Running Crawler.crawl\(\) more than once is deprecated",
+ ):
+ yield crawler.crawl()
+
class SpiderSettingsTestCase(unittest.TestCase):
def test_spider_custom_settings(self):