Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into issue-scrapy#3628
Browse files Browse the repository at this point in the history
  • Loading branch information
DinkyC committed Nov 25, 2023
2 parents f39aead + fa690fb commit b563036
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions tests/test_downloader_handlers.py
Expand Up @@ -726,33 +726,6 @@ def test_download(self):
reason = crawler.spider.meta["close_reason"]
self.assertTrue(reason, "finished")

@defer.inlineCallbacks
def test_download_gzip_response(self):
crawler = get_crawler(SingleRequestSpider, self.settings_dict)
body = b"1" * 100 # PayloadResource requires body length to be 100
request = Request(
self.mockserver.url("/payload"),
method="POST",
body=body,
meta={"download_maxsize": 50},
)
yield crawler.crawl(seed=request)
failure = crawler.spider.meta["failure"]
# download_maxsize < 100, hence the CancelledError
self.assertIsInstance(failure.value, defer.CancelledError)

# See issue https://twistedmatrix.com/trac/ticket/8175
raise unittest.SkipTest("xpayload fails on PY3")
crawler = get_crawler(SingleRequestSpider, self.settings_dict)
request.headers.setdefault(b"Accept-Encoding", b"gzip,deflate")
request = request.replace(url=self.mockserver.url("/xpayload"))
yield crawler.crawl(seed=request)
# download_maxsize = 50 is enough for the gzipped response
failure = crawler.spider.meta.get("failure")
self.assertIsNone(failure)
reason = crawler.spider.meta["close_reason"]
self.assertTrue(reason, "finished")


class UriResource(resource.Resource):
"""Return the full uri that was requested"""
Expand Down

0 comments on commit b563036

Please sign in to comment.