Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Deprecate spider attributes that can be replaced by settings, round 2#7039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Laerte wants to merge15 commits intoscrapy:master
base:master
Choose a base branch
Loading
fromLaerte:master
Open
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
15 commits
Select commitHold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
leftover
  • Loading branch information
@Laerte
Laerte committedSep 14, 2025
commitcac96b516fbfcf09f8f3a4f602ec20945eaa375a
11 changes: 7 additions & 4 deletionstests/test_downloader_handler_twisted_http2.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,6 +31,8 @@
from tests.mockserver.http import MockServer
from tests.mockserver.proxy_echo import ProxyEchoMockServer

from scrapy.utils.misc import build_from_crawler
from scrapy.utils.test import get_crawler

pytestmark = pytest.mark.skipif(
not H2_ENABLED, reason="HTTP/2 support in Twisted is not enabled"
Expand DownExpand Up@@ -63,10 +65,13 @@ async def test_protocol(

@deferred_f_from_coro_f
async def test_download_with_maxsize_very_large_file(
self, mockserver: MockServer, download_handler: DownloadHandlerProtocol
self, mockserver: MockServer
) -> None:
from twisted.internet import reactor

crawler = get_crawler(settings_dict={"DOWNLOAD_MAXSIZE": 1_500})
download_handler = build_from_crawler(self.download_handler_cls, crawler)

with mock.patch("scrapy.core.http2.stream.logger") as logger:
request = Request(
mockserver.url("/largechunkedfile", is_secure=self.is_secure)
Expand All@@ -76,9 +81,7 @@ def check(logger: mock.Mock) -> None:
logger.error.assert_called_once_with(mock.ANY)

with pytest.raises((defer.CancelledError, error.ConnectionAborted)):
await download_request(
download_handler, request, Spider("foo", download_maxsize=1500)
)
await download_request(download_handler, request, Spider("foo"))

# As the error message is logged in the dataReceived callback, we
# have to give a bit of time to the reactor to process the queue
Expand Down
2 changes: 1 addition & 1 deletiontests/test_downloader_handlers_http_base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -303,7 +303,7 @@ async def test_download_with_maxsize(self, mockserver: MockServer) -> None:

@deferred_f_from_coro_f
async def test_download_with_maxsize_very_large_file(
self, mockserver: MockServer, download_handler: DownloadHandlerProtocol
self, mockserver: MockServer
) -> None:
# TODO: the logger check is specific to scrapy.core.downloader.handlers.http11
crawler = get_crawler(settings_dict={"DOWNLOAD_MAXSIZE": 1_500})
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp