diff -Nru requests-2.27.1+dfsg/debian/changelog requests-2.27.1+dfsg/debian/changelog --- requests-2.27.1+dfsg/debian/changelog 2022-03-20 17:51:34.000000000 +0100 +++ requests-2.27.1+dfsg/debian/changelog 2022-05-19 14:14:07.000000000 +0200 @@ -1,3 +1,10 @@ +requests (2.27.1+dfsg-1ubuntu1) kinetic; urgency=medium + + * Fix autopkgtest when http_proxy, https_proxy or no_proxy variable is set + (LP: #1974182) + + -- Olivier Gayot Thu, 19 May 2022 14:14:07 +0200 + requests (2.27.1+dfsg-1) unstable; urgency=medium [ root ] diff -Nru requests-2.27.1+dfsg/debian/control requests-2.27.1+dfsg/debian/control --- requests-2.27.1+dfsg/debian/control 2022-03-20 17:51:34.000000000 +0100 +++ requests-2.27.1+dfsg/debian/control 2022-05-19 14:14:07.000000000 +0200 @@ -1,5 +1,6 @@ Source: requests -Maintainer: Debian Python Team +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Debian Python Team Uploaders: Daniele Tricoli Section: python Priority: optional diff -Nru requests-2.27.1+dfsg/debian/patches/0002-Fix-tests-with-HTTP-proxy.patch requests-2.27.1+dfsg/debian/patches/0002-Fix-tests-with-HTTP-proxy.patch --- requests-2.27.1+dfsg/debian/patches/0002-Fix-tests-with-HTTP-proxy.patch 1970-01-01 01:00:00.000000000 +0100 +++ requests-2.27.1+dfsg/debian/patches/0002-Fix-tests-with-HTTP-proxy.patch 2022-05-19 14:14:07.000000000 +0200 @@ -0,0 +1,83 @@ +Description: Fix autopkgtest when HTTP/HTTPS proxy is set + The pytest suite does not expect the http_proxy, https_proxy and no_proxy + variables to be present in the environment. They make pytest fail and + therefore autopkgtest fail as well. +Author: Olivier Gayot +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1011276 +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/requests/+bug/1974182 +Forwarded: no +Last-Update: 2022-05-19 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +Index: b/tests/test_requests.py +=================================================================== +--- a/tests/test_requests.py 2022-01-05 16:35:04.000000000 +0100 ++++ b/tests/test_requests.py 2022-05-19 14:13:08.454208318 +0200 +@@ -535,8 +535,9 @@ + ('http://fe80::5054:ff:fe5a:fc0', InvalidURL) + )) + def test_errors(self, url, exception): +- with pytest.raises(exception): +- requests.get(url, timeout=1) ++ with override_environ(http_proxy=None, https_proxy=None): ++ with pytest.raises(exception): ++ requests.get(url, timeout=1) + + def test_proxy_error(self): + # any proxy related error (address resolution, no route to host, etc) should result in a ProxyError +@@ -557,14 +558,14 @@ + requests.get(httpbin(), proxies={'http': 'http:///example.com:8080'}) + + def test_respect_proxy_env_on_send_self_prepared_request(self, httpbin): +- with override_environ(http_proxy=INVALID_PROXY): ++ with override_environ(no_proxy=None, http_proxy=INVALID_PROXY): + with pytest.raises(ProxyError): + session = requests.Session() + request = requests.Request('GET', httpbin()) + session.send(request.prepare()) + + def test_respect_proxy_env_on_send_session_prepared_request(self, httpbin): +- with override_environ(http_proxy=INVALID_PROXY): ++ with override_environ(no_proxy=None, http_proxy=INVALID_PROXY): + with pytest.raises(ProxyError): + session = requests.Session() + request = requests.Request('GET', httpbin()) +@@ -572,7 +573,7 @@ + session.send(prepared) + + def test_respect_proxy_env_on_send_with_redirects(self, httpbin): +- with override_environ(http_proxy=INVALID_PROXY): ++ with override_environ(no_proxy=None, http_proxy=INVALID_PROXY): + with pytest.raises(ProxyError): + session = requests.Session() + url = httpbin('redirect/1') +@@ -581,13 +582,13 @@ + session.send(request.prepare()) + + def test_respect_proxy_env_on_get(self, httpbin): +- with override_environ(http_proxy=INVALID_PROXY): ++ with override_environ(no_proxy=None, http_proxy=INVALID_PROXY): + with pytest.raises(ProxyError): + session = requests.Session() + session.get(httpbin()) + + def test_respect_proxy_env_on_request(self, httpbin): +- with override_environ(http_proxy=INVALID_PROXY): ++ with override_environ(no_proxy=None, http_proxy=INVALID_PROXY): + with pytest.raises(ProxyError): + session = requests.Session() + session.request(method='GET', url=httpbin()) +Index: b/tests/utils.py +=================================================================== +--- a/tests/utils.py 2022-01-05 16:35:04.000000000 +0100 ++++ b/tests/utils.py 2022-05-19 14:11:28.470186792 +0200 +@@ -9,7 +9,8 @@ + save_env = dict(os.environ) + for key, value in kwargs.items(): + if value is None: +- del os.environ[key] ++ with contextlib.suppress(KeyError): ++ del os.environ[key] + else: + os.environ[key] = value + try: diff -Nru requests-2.27.1+dfsg/debian/patches/series requests-2.27.1+dfsg/debian/patches/series --- requests-2.27.1+dfsg/debian/patches/series 2022-03-20 17:51:34.000000000 +0100 +++ requests-2.27.1+dfsg/debian/patches/series 2022-05-19 14:10:52.000000000 +0200 @@ -1 +1,2 @@ 0001-Remove-remote-images-traking-code-and-ads.patch +0002-Fix-tests-with-HTTP-proxy.patch