Update test expectations

This commit is contained in:
Adrián Chaves 2025-03-15 02:45:31 +01:00
parent dbdfb1854d
commit 0a4223ffeb
2 changed files with 15 additions and 18 deletions

View File

@ -1,7 +1,7 @@
import gzip
import warnings
from io import BytesIO
from logging import ERROR, WARNING
from logging import WARNING
from pathlib import Path
from typing import Any
from unittest import mock
@ -447,23 +447,6 @@ class TestCrawlSpider(TestSpider):
assert hasattr(spider, "_follow_links")
assert not spider._follow_links
@inlineCallbacks
def test_start_url(self):
class TestSpider(self.spider_class):
name = "test"
start_url = "https://www.example.com"
crawler = get_crawler(TestSpider)
with LogCapture("scrapy.core.engine", propagate=False, level=ERROR) as log:
yield crawler.crawl()
log.check(
(
"scrapy.core.engine",
"ERROR",
"Error while reading seeds",
),
)
class TestSitemapSpider(TestSpider):
spider_class = SitemapSpider

View File

@ -220,3 +220,17 @@ class MainTestCase(TestCase):
await self._test_yield_seeds(yield_seeds, [ITEM_A])
assert "in yield_seeds\n raise RuntimeError" in str(log), log
@deferred_f_from_coro_f
async def test_start_url(self):
class TestSpider(Spider):
name = "test"
start_url = "https://toscrape.com"
with LogCapture() as log:
await self._test_spider(TestSpider, [])
assert "Error while reading seeds" in str(log), log
assert "found 'start_url' attribute instead, did you miss an 's'?" in str(
log
), log