forked from pool/python-wsgi_intercept
87 lines
3.4 KiB
Diff
87 lines
3.4 KiB
Diff
![]() |
From c4d44f5712e85d302db7e80e16156ca9c501bb6b Mon Sep 17 00:00:00 2001
|
||
|
From: Chris Dent <cdent@anticdent.org>
|
||
|
Date: Tue, 15 Oct 2019 12:10:10 +0100
|
||
|
Subject: [PATCH] Updates for dependent library changes
|
||
|
|
||
|
httplib2 added some more kwargs, so rather than continuing
|
||
|
to explicitly list each one (they are ignored), use **kwargs
|
||
|
instead.
|
||
|
|
||
|
update some tests to work correctly with modern pytest, which
|
||
|
no longer allows the string-as-callable to check for exceptions.
|
||
|
Use py.test.raises context manager instead.
|
||
|
|
||
|
remove python versions that tox no longer supports
|
||
|
---
|
||
|
wsgi_intercept/httplib2_intercept.py | 3 +--
|
||
|
wsgi_intercept/tests/test_httplib2.py | 7 +++----
|
||
|
wsgi_intercept/tests/test_requests.py | 5 ++---
|
||
|
wsgi_intercept/tests/test_urllib3.py | 6 ++----
|
||
|
5 files changed, 9 insertions(+), 14 deletions(-)
|
||
|
|
||
|
diff --git a/wsgi_intercept/httplib2_intercept.py b/wsgi_intercept/httplib2_intercept.py
|
||
|
index 1edbfbd..ae92a9d 100644
|
||
|
--- a/wsgi_intercept/httplib2_intercept.py
|
||
|
+++ b/wsgi_intercept/httplib2_intercept.py
|
||
|
@@ -32,8 +32,7 @@ class HTTPS_WSGIInterceptorWithTimeout(HTTPSInterceptorMixin,
|
||
|
HTTPSConnectionWithTimeout):
|
||
|
def __init__(self, host, port=None, strict=None, timeout=None,
|
||
|
proxy_info=None, ca_certs=None, source_address=None,
|
||
|
- disable_ssl_certificate_validation=False,
|
||
|
- ssl_version=None):
|
||
|
+ **kwargs):
|
||
|
|
||
|
# ignore proxy_info and ca_certs
|
||
|
# In Python3 strict is deprecated
|
||
|
diff --git a/wsgi_intercept/tests/test_httplib2.py b/wsgi_intercept/tests/test_httplib2.py
|
||
|
index 160cce4..0f1e177 100644
|
||
|
--- a/wsgi_intercept/tests/test_httplib2.py
|
||
|
+++ b/wsgi_intercept/tests/test_httplib2.py
|
||
|
@@ -42,10 +42,9 @@ def test_http_other_port():
|
||
|
|
||
|
def test_bogus_domain():
|
||
|
with InstalledApp(wsgi_app.simple_app, host=HOST, port=80):
|
||
|
- py.test.raises(
|
||
|
- gaierror,
|
||
|
- 'httplib2_intercept.HTTP_WSGIInterceptorWithTimeout('
|
||
|
- '"_nonexistant_domain_").connect()')
|
||
|
+ with py.test.raises(gaierror):
|
||
|
+ httplib2_intercept.HTTP_WSGIInterceptorWithTimeout(
|
||
|
+ "_nonexistant_domain_").connect()
|
||
|
|
||
|
|
||
|
def test_proxy_handling():
|
||
|
diff --git a/wsgi_intercept/tests/test_requests.py b/wsgi_intercept/tests/test_requests.py
|
||
|
index 8c09a37..4d69ba9 100644
|
||
|
--- a/wsgi_intercept/tests/test_requests.py
|
||
|
+++ b/wsgi_intercept/tests/test_requests.py
|
||
|
@@ -36,9 +36,8 @@ def test_http_other_port():
|
||
|
|
||
|
def test_bogus_domain():
|
||
|
with InstalledApp(wsgi_app.simple_app, host=HOST, port=80):
|
||
|
- py.test.raises(
|
||
|
- ConnectionError,
|
||
|
- 'requests.get("http://_nonexistant_domain_")')
|
||
|
+ with py.test.raises(ConnectionError):
|
||
|
+ requests.get("http://_nonexistant_domain_")
|
||
|
|
||
|
|
||
|
def test_proxy_handling():
|
||
|
diff --git a/wsgi_intercept/tests/test_urllib3.py b/wsgi_intercept/tests/test_urllib3.py
|
||
|
index 021b614..229a309 100644
|
||
|
--- a/wsgi_intercept/tests/test_urllib3.py
|
||
|
+++ b/wsgi_intercept/tests/test_urllib3.py
|
||
|
@@ -38,10 +38,8 @@ def test_http_other_port():
|
||
|
|
||
|
def test_bogus_domain():
|
||
|
with InstalledApp(wsgi_app.simple_app, host=HOST, port=80):
|
||
|
- py.test.raises(
|
||
|
- urllib3.exceptions.ProtocolError,
|
||
|
- 'http.request("GET", "http://_nonexistant_domain_", '
|
||
|
- 'retries=False)')
|
||
|
+ with py.test.raises(urllib3.exceptions.ProtocolError):
|
||
|
+ http.request("GET", "http://_nonexistant_domain_", retries=False)
|
||
|
|
||
|
|
||
|
def test_proxy_handling():
|