Retry failed dummyserver tests once
MODIFY
dev-requirements.txt
dev-requirements.txt
@@ -6,6 +6,7 @@ PySocks==1.6.8
pkginfo==1.4.2
pytest-timeout==1.3.3
pytest==4.6.4
+flaky==3.6.1
# https://github.com/ionelmc/python-lazy-object-proxy/issues/30
lazy-object-proxy==1.4.0

MODIFY
noxfile.py
noxfile.py
@@ -30,6 +30,7 @@ def tests_impl(session, extras="socks,secure,brotli"):
"pytest",
"-r",
"sx",
+ "--no-success-flaky-report",
*(session.posargs or ("test/",)),
env={"PYTHONWARNINGS": "always::DeprecationWarning"}
)

MODIFY
test/with_dummyserver/test_chunked_transfer.py
test/with_dummyserver/test_chunked_transfer.py
# -*- coding: utf-8 -*-
+import pytest
+
from urllib3 import HTTPConnectionPool
from urllib3.util.retry import Retry
from dummyserver.testcase import SocketDummyServerTestCase, consume_socket
+# Retry failed tests
+pytestmark = pytest.mark.flaky
+
class TestChunkedTransfer(SocketDummyServerTestCase):
def start_chunked_handler(self):

MODIFY
test/with_dummyserver/test_connectionpool.py
test/with_dummyserver/test_connectionpool.py
@@ -30,6 +30,8 @@ from dummyserver.server import NoIPv6Warning, HAS_IPV6_AND_DNS
from threading import Event
+pytestmark = pytest.mark.flaky
+
log = logging.getLogger("urllib3.connectionpool")
log.setLevel(logging.NOTSET)
log.addHandler(logging.StreamHandler(sys.stdout))

MODIFY
test/with_dummyserver/test_https.py
test/with_dummyserver/test_https.py
@@ -55,6 +55,8 @@ from urllib3.packages import six
from urllib3.util.timeout import Timeout
import urllib3.util as util
+# Retry failed tests
+pytestmark = pytest.mark.flaky
ResourceWarning = getattr(
six.moves.builtins, "ResourceWarning", type("ResourceWarning", (), {})

MODIFY
test/with_dummyserver/test_no_ssl.py
test/with_dummyserver/test_no_ssl.py
@@ -3,12 +3,16 @@ Test connections without the builtin ssl module
Note: Import urllib3 inside the test functions to get the importblocker to work
"""
+import pytest
from ..test_no_ssl import TestWithoutSSL
from dummyserver.testcase import HTTPDummyServerTestCase, HTTPSDummyServerTestCase
import urllib3
+# Retry failed tests
+pytestmark = pytest.mark.flaky
+
class TestHTTPWithoutSSL(HTTPDummyServerTestCase, TestWithoutSSL):
def test_simple(self):

MODIFY
test/with_dummyserver/test_poolmanager.py
test/with_dummyserver/test_poolmanager.py
@@ -9,6 +9,9 @@ from urllib3.connectionpool import port_by_scheme
from urllib3.exceptions import MaxRetryError
from urllib3.util.retry import Retry
+# Retry failed tests
+pytestmark = pytest.mark.flaky
+
class TestPoolManager(HTTPDummyServerTestCase):
@classmethod

MODIFY
test/with_dummyserver/test_proxy_poolmanager.py
test/with_dummyserver/test_proxy_poolmanager.py
@@ -12,6 +12,9 @@ from urllib3.poolmanager import proxy_from_url, ProxyManager
from urllib3.exceptions import MaxRetryError, SSLError, ProxyError, ConnectTimeoutError
from urllib3.connectionpool import connection_from_url, VerifiedHTTPSConnection
+# Retry failed tests
+pytestmark = pytest.mark.flaky
+
class TestHTTPProxyManager(HTTPDummyProxyTestCase):
@classmethod

MODIFY
test/with_dummyserver/test_socketlevel.py
test/with_dummyserver/test_socketlevel.py
@@ -49,6 +49,9 @@ import pytest
from test import fails_on_travis_gce, requires_ssl_context_keyfile_password
+# Retry failed tests
+pytestmark = pytest.mark.flaky
+
class TestCookies(SocketDummyServerTestCase):
def test_multi_setcookie(self):

Retry failed dummyserver tests once (#1718)