summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSeth M. Larson <sethmichaellarson@gmail.com>2018-11-22 14:54:28 -0600
committerGitHub <noreply@github.com>2018-11-22 14:54:28 -0600
commite3aebd4e79779ad4eef902e81ebbb6ec54335dfc (patch)
tree27aee62fdb20a4fc1f7539335e3c4286c8ce62c3 /test
parentd0255e01b616f02b45eb207459937a9666e13af6 (diff)
downloadurllib3-e3aebd4e79779ad4eef902e81ebbb6ec54335dfc.tar.gz
Start testing against Python 3.8 (#1475)
Diffstat (limited to 'test')
-rw-r--r--test/__init__.py16
-rw-r--r--test/with_dummyserver/test_https.py2
-rw-r--r--test/with_dummyserver/test_socketlevel.py3
3 files changed, 21 insertions, 0 deletions
diff --git a/test/__init__.py b/test/__init__.py
index 1db7cd59..2c12d44a 100644
--- a/test/__init__.py
+++ b/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__()
diff --git a/test/with_dummyserver/test_https.py b/test/with_dummyserver/test_https.py
index 082ede96..3f6b6c07 100644
--- a/test/with_dummyserver/test_https.py
+++ b/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', '/')
diff --git a/test/with_dummyserver/test_socketlevel.py b/test/with_dummyserver/test_socketlevel.py
index 8f2cf9e9..778b7c58 100644
--- a/test/with_dummyserver/test_socketlevel.py
+++ b/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 = []