Skip to content

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

Fix mypy, pylint and codspeed CI failures (#8115)

Adrian2326482d92c6
diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml
index d2146b8e9..5f09c4961 100644
--- a/.github/workflows/codspeed.yml
+++ b/.github/workflows/codspeed.yml
@@ -24,7 +24,7 @@ jobs:
benchmark:
if: github.event.action != 'closed'
runs-on: ubuntu-latest
- timeout-minutes: 15
+ timeout-minutes: 25
env:
# Make uv use the interpreter that actions/setup-python installed
# instead of downloading one of its own.
diff --git a/tests/benchmarks/test_crawl.py b/tests/benchmarks/test_crawl.py
index c52421fcf..8170361ef 100644
--- a/tests/benchmarks/test_crawl.py
+++ b/tests/benchmarks/test_crawl.py
@@ -314,7 +314,7 @@ def test_overhead_delay(benchmark: BenchmarkFixture) -> None:
The delay is not randomized, so that wall time, and hence the number of
reactor iterations that the crawl needs, does not change between runs.
"""
- settings = {"DOWNLOAD_DELAY": DELAY, "RANDOMIZE_DOWNLOAD_DELAY": False}
+ settings = {"DOWNLOAD_DELAY": DELAY, "DOWNLOAD_DELAY_JITTER": 0}
benchmark(lambda: _crawl_tree(settings, domains=1, pages=DELAYED_REQUESTS))
diff --git a/tests/test_downloader_handlers.py b/tests/test_downloader_handlers.py
index 046b63590..ad77fd7dd 100644
--- a/tests/test_downloader_handlers.py
+++ b/tests/test_downloader_handlers.py
@@ -423,7 +423,7 @@ class TestDataURI:
request = Request("data:image/png;base64,iVBORw0KGgo%3D")
response = await self.download_request(request)
assert response.body == b"\x89PNG\r\n\x1a\n"
- assert type(response) is responsetypes.from_mimetype("image/png") # pylint: disable=unidiomatic-typecheck
+ assert type(response) is responsetypes.from_mimetype("image/png")
assert not isinstance(response, TextResponse)
@coroutine_test
diff --git a/tests/test_spidermiddleware_output_chain.py b/tests/test_spidermiddleware_output_chain.py
index 41a6ac9a6..de7ecdc61 100644
--- a/tests/test_spidermiddleware_output_chain.py
+++ b/tests/test_spidermiddleware_output_chain.py
@@ -269,7 +269,7 @@ class ThirdUnhandledMiddleware(_GeneratorDoNothingMiddleware):
pass
-class UnhandledExceptionSpider(Spider):
+class UnhandledExceptionSpider(MockServerSpider):
name = "UnhandledExceptionSpider"
custom_settings = {
"SPIDER_MIDDLEWARES": {
@@ -280,6 +280,7 @@ class UnhandledExceptionSpider(Spider):
}
async def start(self):
+ assert self.mockserver
yield Request(self.mockserver.url("/status?n=200"))
def parse(self, response):