From 78a0a52bd9ac08c2a313f72bf08447439ca3c74e Mon Sep 17 00:00:00 2001 From: Arthur Hamon Date: Thu, 13 Jun 2019 15:17:39 +0200 Subject: [PATCH 1/6] fix issue with tests using localhost The error we have : SSLError: hostname '127.0.0.1' doesn't match either of 'localhost', '127.0.0.1' This is fixed by adding the `ipaddress` dependency in the tox ini. --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index 0f2aae1..901a565 100644 --- a/tox.ini +++ b/tox.ini @@ -18,6 +18,7 @@ deps = pytest pytest-httpbin PyYAML + ipaddress requests: requests>=2.22.0 httplib2: httplib2 urllib3121: urllib3==1.21.1 From a53121b645107307cfbc69756a2650117f33820b Mon Sep 17 00:00:00 2001 From: Arthur Hamon Date: Thu, 13 Jun 2019 15:19:45 +0200 Subject: [PATCH 2/6] do not create tox environment with python2 and aiohttp aiohttp dependency only works with python 3.5+ --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 901a565..d0542fb 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = {py27,py35,py36,py37,pypy}-{flakes,requests,httplib2,urllib3121,tornado4,boto3,aiohttp} +envlist = {py27,py35,py36,py37,pypy}-{flakes,requests,httplib2,urllib3121,tornado4,boto3},{py35,py36,py37}-{aiohttp} [testenv:flakes] skipsdist = True From c4803dbc4d5693c8cc46fa2e93721b9ea3aabb69 Mon Sep 17 00:00:00 2001 From: Arthur Hamon Date: Thu, 13 Jun 2019 15:21:02 +0200 Subject: [PATCH 3/6] httplib2 has issues validating certificate with python 2.7, disabling it --- tests/integration/test_httplib2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/test_httplib2.py b/tests/integration/test_httplib2.py index 4eda032..e203c1f 100644 --- a/tests/integration/test_httplib2.py +++ b/tests/integration/test_httplib2.py @@ -22,7 +22,7 @@ def http(): kwargs = { 'ca_certs': pytest_httpbin.certs.where() } - if sys.version_info[:2] == (3, 7): + if sys.version_info[:2] in [(2, 7), (3, 7)]: kwargs['disable_ssl_certificate_validation'] = True return httplib2.Http(**kwargs) From 7724b364aad3215093be6ebd593fd00333a504cb Mon Sep 17 00:00:00 2001 From: Arthur Hamon Date: Thu, 13 Jun 2019 15:21:44 +0200 Subject: [PATCH 4/6] urllib3 has a new default behavior with PoolManager object creation By default, from version urllib3=>1.25, urllib3 requires and validates certificates by default when using HTTPS (https://github.com/urllib3/urllib3/blob/master/CHANGES.rst#125-2019-04-22). Set explicitly that we deactivate certificates validation with cert_reqs=`CERT_NONE`. --- tests/integration/test_urllib3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/test_urllib3.py b/tests/integration/test_urllib3.py index d187f7b..6d4a93c 100644 --- a/tests/integration/test_urllib3.py +++ b/tests/integration/test_urllib3.py @@ -20,7 +20,7 @@ def verify_pool_mgr(): @pytest.fixture(scope='module') def pool_mgr(): - return urllib3.PoolManager() + return urllib3.PoolManager(cert_reqs='CERT_NONE') def test_status_code(httpbin_both, tmpdir, verify_pool_mgr): From 34f0417dc97cc6d0d44e1a58b90734dcffd9f315 Mon Sep 17 00:00:00 2001 From: Arthur Hamon Date: Thu, 13 Jun 2019 15:51:28 +0200 Subject: [PATCH 5/6] add troubleshooting in contributing section When I ran the test suite on macOSX, I had some issues regarding SSL configuration, I have documented the error I encounter and the solution to deal with it. --- docs/contributing.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/contributing.rst b/docs/contributing.rst index f5ffc84..63865a6 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -23,3 +23,24 @@ documentation `__ for how to set this up. I have marked the boto tests as optional in Travis so you don't have to worry about them failing if you submit a pull request. + + +Troubleshooting on MacOSX +------------------------- + +If you have this kind of error when running tox : + +.. code:: python + + __main__.ConfigurationError: Curl is configured to use SSL, but we have + not been able to determine which SSL backend it is using. Please see PycURL documentation for how to specify the SSL backend manually. + +Then you need to define some environment variables: + +.. code:: bash + + export PYCURL_SSL_LIBRARY=openssl + export LDFLAGS=-L/usr/local/opt/openssl/lib + export CPPFLAGS=-I/usr/local/opt/openssl/include + +Reference : `stackoverflow issue `__ From bdb74b9841e411d2d47af9760f00e43e5648e1f8 Mon Sep 17 00:00:00 2001 From: Arthur Hamon Date: Fri, 14 Jun 2019 12:42:19 +0200 Subject: [PATCH 6/6] change requests27 in travis-ci to requests --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 180b1dd..4988390 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ env: - secure: LBSEg/gMj4u4Hrpo3zs6Y/1mTpd2RtcN49mZIFgTdbJ9IhpiNPqcEt647Lz94F9Eses2x2WbNuKqZKZZReY7QLbEzU1m0nN5jlaKrjcG5NR5clNABfFFyhgc0jBikyS4abAG8jc2efeaTrFuQwdoF4sE8YiVrkiVj2X5Xoi6sBk= matrix: - TOX_SUFFIX="flakes" - - TOX_SUFFIX="requests27" + - TOX_SUFFIX="requests" - TOX_SUFFIX="httplib2" - TOX_SUFFIX="boto3" - TOX_SUFFIX="urllib3121" @@ -17,7 +17,7 @@ matrix: - env: TOX_SUFFIX="flakes" python: 3.7 dist: xenial - - env: TOX_SUFFIX="requests27" + - env: TOX_SUFFIX="requests" python: 3.7 dist: xenial - env: TOX_SUFFIX="httplib2"