From 0bd64426471ef8bdc8d12b83299dad61064fcf4e Mon Sep 17 00:00:00 2001 From: Chris Dent Date: Fri, 18 Mar 2016 15:57:03 +0000 Subject: [PATCH] Force urllib3 to raise errors immediately Otherwise it raises the MaxRetryError, masking the real one. --- test/test_interceptor.py | 4 ++-- test/test_urllib3.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/test_interceptor.py b/test/test_interceptor.py index 66e0881..de0e9ca 100644 --- a/test/test_interceptor.py +++ b/test/test_interceptor.py @@ -211,8 +211,8 @@ def test_urllib3_in_out(): assert 'WSGI intercept successful!' in str(response.data) # outside the context manager the intercept does not work - with py.test.raises(urllib3.exceptions.MaxRetryError): - httppool.request('GET', url) + with py.test.raises(urllib3.exceptions.ProtocolError): + httppool.request('GET', url, retries=False) # urllib diff --git a/test/test_urllib3.py b/test/test_urllib3.py index 8206d5e..ccf1e40 100644 --- a/test/test_urllib3.py +++ b/test/test_urllib3.py @@ -38,8 +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.MaxRetryError, - 'http.request("GET", "http://_nonexistant_domain_")') + urllib3.exceptions.ProtocolError, + 'http.request("GET", "http://_nonexistant_domain_", retries=False)') def test_proxy_handling():