Start testing against Python 3.8
MODIFY
.travis.yml
.travis.yml
@@ -2,6 +2,7 @@ language: python
script:
- ./_travis/run.sh
before_install:
+ - env
- openssl version
after_success:
- ./_travis/upload_coverage.sh
@@ -33,6 +34,11 @@ matrix:
env: TOXENV=py36
- python: 3.7-dev
env: TOXENV=py37
+ - python: 3.8-dev
+ env: TOXENV=py38
+ dist: xenial
+ sudo: required
+
- python: pypy-5.4
env: TOXENV=pypy
- language: generic
@@ -50,6 +56,9 @@ matrix:
- language: generic
os: osx
env: TOXENV=py37
+ - language: generic
+ os: osx
+ env: TOXENV=py38
allow_failures:
- python: pypy-5.4
sudo: false

MODIFY
_travis/install.sh
_travis/install.sh
@@ -6,7 +6,6 @@ set -x
if [[ "$(uname -s)" == 'Darwin' ]]; then
sw_vers
brew update || brew update
-
brew outdated openssl || brew upgrade openssl
brew install openssl@1.1
@@ -37,6 +36,10 @@ if [[ "$(uname -s)" == 'Darwin' ]]; then
pyenv install 3.7-dev
pyenv global 3.7-dev
;;
+ py38)
+ pyenv install 3.8-dev
+ pyenv global 3.8-dev
+ ;;
pypy*)
pyenv install "pypy-5.4.1"
pyenv global "pypy-5.4.1"

MODIFY
setup.cfg
setup.cfg
@@ -17,3 +17,6 @@ requires-dist =
certifi; extra == 'secure'
ipaddress; python_version=="2.7" and extra == 'secure'
PySocks>=1.5.6,<2.0,!=1.5.7; extra == 'socks'
+
+[pytest]
+xfail_strict = true

MODIFY
setup.py
setup.py
@@ -35,6 +35,8 @@ setup(name='urllib3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
+ 'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Internet :: WWW/HTTP',

MODIFY
test/__init__.py
test/__init__.py
@@ -4,6 +4,7 @@ import errno
import functools
import logging
import socket
+import os
import pytest
@@ -123,6 +124,21 @@ def requires_network(test):
return wrapper
+def fails_on_travis_gce(test):
+ """Expect the test to fail on Google Compute Engine instances for Travis.
+ Travis uses GCE for its sudo: enabled builds.
+
+ Reason for this decorator:
+ https://github.com/urllib3/urllib3/pull/1475#issuecomment-440788064
+ """
+ @functools.wraps(test)
+ def wrapper(*args, **kwargs):
+ if os.environ.get("TRAVIS_INFRA") == "gce":
+ pytest.xfail("%s is expected to fail on Travis GCE builds" % test.__name__)
+ return test(*args, **kwargs)
+ return wrapper
+
+
class _ListHandler(logging.Handler):
def __init__(self):
super(_ListHandler, self).__init__()

MODIFY
test/with_dummyserver/test_https.py
test/with_dummyserver/test_https.py
@@ -23,6 +23,7 @@ from test import (
onlyPy279OrNewer,
notSecureTransport,
requires_network,
+ fails_on_travis_gce,
TARPIT_HOST,
)
from urllib3 import HTTPSConnectionPool
@@ -64,6 +65,7 @@ class TestHTTPS(HTTPSDummyServerTestCase):
r = self._pool.request('GET', '/')
self.assertEqual(r.status, 200, r.data)
+ @fails_on_travis_gce
def test_dotted_fqdn(self):
pool = HTTPSConnectionPool(self.host + '.', self.port)
r = pool.request('GET', '/')

MODIFY
test/with_dummyserver/test_socketlevel.py
test/with_dummyserver/test_socketlevel.py
@@ -35,6 +35,8 @@ import ssl
import pytest
+from test import fails_on_travis_gce
+
class TestCookies(SocketDummyServerTestCase):
@@ -1218,6 +1220,7 @@ class TestHeaders(SocketDummyServerTestCase):
pool.request('GET', '/', headers=OrderedDict(expected_request_headers))
self.assertEqual(expected_request_headers, actual_request_headers)
+ @fails_on_travis_gce
def test_request_host_header_ignores_fqdn_dot(self):
received_headers = []

MODIFY
tox.ini
tox.ini
[tox]
-envlist = flake8-py3, py27, py34, py35, py36, py37, pypy
+envlist = flake8-py3, py27, py34, py35, py36, py37, py38, pypy
[testenv]
deps= -r{toxinidir}/dev-requirements.txt
@@ -18,7 +18,7 @@ commands=
coverage report -m
setenv =
PYTHONWARNINGS=always::DeprecationWarning
-passenv = CFLAGS LDFLAGS TRAVIS APPVEYOR CRYPTOGRAPHY_OSX_NO_LINK_FLAGS
+passenv = CFLAGS LDFLAGS TRAVIS APPVEYOR CRYPTOGRAPHY_OSX_NO_LINK_FLAGS TRAVIS_INFRA
[testenv:gae]
basepython = python2.7

Start testing against Python 3.8 (#1475)