Skip to content

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

Restore test_download_with_proxy_https_noconnect, check for a warning there.

Andrey Rakhmatullin2d92a39003a5
diff --git a/tests/test_downloader_handlers.py b/tests/test_downloader_handlers.py
index 45d4aa952..87ab4c9e5 100644
--- a/tests/test_downloader_handlers.py
+++ b/tests/test_downloader_handlers.py
@@ -33,7 +33,7 @@ from scrapy.responsetypes import responsetypes
from scrapy.settings import Settings
from scrapy.utils.test import get_crawler, skip_if_no_boto
from scrapy.utils.python import to_bytes
-from scrapy.exceptions import NotConfigured
+from scrapy.exceptions import NotConfigured, ScrapyDeprecationWarning
from tests.mockserver import MockServer, ssl_context_factory, Echo
from tests.spiders import SingleRequestSpider
@@ -687,6 +687,18 @@ class HttpProxyTestCase(unittest.TestCase):
request = Request('http://example.com', meta={'proxy': http_proxy})
return self.download_request(request, Spider('foo')).addCallback(_test)
+ def test_download_with_proxy_https_noconnect(self):
+ def _test(response):
+ self.assertEqual(response.status, 200)
+ self.assertEqual(response.url, request.url)
+ self.assertEqual(response.body, b'https://example.com')
+
+ http_proxy = '%s?noconnect' % self.getURL('')
+ request = Request('https://example.com', meta={'proxy': http_proxy})
+ with self.assertWarnsRegex(ScrapyDeprecationWarning,
+ r'Using HTTPS proxies in the noconnect mode is deprecated'):
+ return self.download_request(request, Spider('foo')).addCallback(_test)
+
def test_download_without_proxy(self):
def _test(response):
self.assertEqual(response.status, 200)