From 8e02d4e1fe18a2f2099261cd086cbcd77b7a1726 Mon Sep 17 00:00:00 2001 From: Chris Dent Date: Fri, 18 Mar 2016 13:24:10 +0000 Subject: [PATCH] Fix for python3 in use of urllib3.Response.data Is bytes, we need to cast it to str to do `in`. --- test/test_interceptor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_interceptor.py b/test/test_interceptor.py index 9e986d5..66e0881 100644 --- a/test/test_interceptor.py +++ b/test/test_interceptor.py @@ -188,7 +188,7 @@ def test_urllib3_interceptor_host(): with Urllib3Interceptor(app=app, host=hostname, port=port) as url: response = httppool.request('GET', url) assert response.status == 200 - assert 'WSGI intercept successful!' in response.data + assert 'WSGI intercept successful!' in str(response.data) def test_urllib3_interceptor_url(): @@ -198,7 +198,7 @@ def test_urllib3_interceptor_url(): with Urllib3Interceptor(app=app, url=url) as target_url: response = httppool.request('GET', target_url) assert response.status == 200 - assert 'WSGI intercept successful!' in response.data + assert 'WSGI intercept successful!' in str(response.data) def test_urllib3_in_out(): @@ -208,7 +208,7 @@ def test_urllib3_in_out(): with Urllib3Interceptor(app=app, url=url) as target_url: response = httppool.request('GET', target_url) assert response.status == 200 - assert 'WSGI intercept successful!' in response.data + assert 'WSGI intercept successful!' in str(response.data) # outside the context manager the intercept does not work with py.test.raises(urllib3.exceptions.MaxRetryError):