summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2019-12-10 19:32:59 (GMT)
committerGitHub <noreply@github.com>2019-12-10 19:32:59 (GMT)
commit07871b256c76ca561554d1f82b430fc64a5c7ee0 (patch)
tree2870562d7cf2df7448eb5a16aedb00f2ec3f34ee /Lib/test/test_asyncio
parent680068c28896baba36fa7361976e07bb0f588561 (diff)
downloadcpython-07871b256c76ca561554d1f82b430fc64a5c7ee0.zip
cpython-07871b256c76ca561554d1f82b430fc64a5c7ee0.tar.gz
cpython-07871b256c76ca561554d1f82b430fc64a5c7ee0.tar.bz2
bpo-38614: Use test.support.LOOPBACK_TIMEOUT constant (GH-17554)
Replace hardcoded timeout constants in tests with LOOPBACK_TIMEOUT of test.support, so it's easier to ajdust this timeout for all tests at once.
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r--Lib/test/test_asyncio/functional.py5
-rw-r--r--Lib/test/test_asyncio/test_events.py2
-rw-r--r--Lib/test/test_asyncio/test_sslproto.py3
-rw-r--r--Lib/test/test_asyncio/utils.py4
4 files changed, 8 insertions, 6 deletions
diff --git a/Lib/test/test_asyncio/functional.py b/Lib/test/test_asyncio/functional.py
index 4620d3e..5cd0659 100644
--- a/Lib/test/test_asyncio/functional.py
+++ b/Lib/test/test_asyncio/functional.py
@@ -7,6 +7,7 @@ import select
import socket
import tempfile
import threading
+from test import support
class FunctionalTestCaseMixin:
@@ -49,7 +50,7 @@ class FunctionalTestCaseMixin:
def tcp_server(self, server_prog, *,
family=socket.AF_INET,
addr=None,
- timeout=5,
+ timeout=support.LOOPBACK_TIMEOUT,
backlog=1,
max_clients=10):
@@ -72,7 +73,7 @@ class FunctionalTestCaseMixin:
def tcp_client(self, client_prog,
family=socket.AF_INET,
- timeout=10):
+ timeout=support.LOOPBACK_TIMEOUT):
sock = socket.socket(family, socket.SOCK_STREAM)
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
index 7256758..5ffb3d3 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -724,7 +724,7 @@ class EventLoopTestsMixin:
sock = socket.socket()
self.addCleanup(sock.close)
coro = self.loop.connect_accepted_socket(
- MyProto, sock, ssl_handshake_timeout=1)
+ MyProto, sock, ssl_handshake_timeout=support.LOOPBACK_TIMEOUT)
with self.assertRaisesRegex(
ValueError,
'ssl_handshake_timeout is only meaningful with ssl'):
diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py
index a7c0890..7ba3d73 100644
--- a/Lib/test/test_asyncio/test_sslproto.py
+++ b/Lib/test/test_asyncio/test_sslproto.py
@@ -3,6 +3,7 @@
import logging
import socket
import sys
+from test import support
import unittest
import weakref
from unittest import mock
@@ -699,7 +700,7 @@ class BaseStartTLS(func_tests.FunctionalTestCaseMixin):
ssl=client_sslctx,
server_hostname='',
loop=self.loop,
- ssl_handshake_timeout=1.0)
+ ssl_handshake_timeout=support.LOOPBACK_TIMEOUT)
with self.tcp_server(server,
max_clients=1,
diff --git a/Lib/test/test_asyncio/utils.py b/Lib/test/test_asyncio/utils.py
index ea608f4..6d8a6e2 100644
--- a/Lib/test/test_asyncio/utils.py
+++ b/Lib/test/test_asyncio/utils.py
@@ -139,7 +139,7 @@ class SilentWSGIRequestHandler(WSGIRequestHandler):
class SilentWSGIServer(WSGIServer):
- request_timeout = 2
+ request_timeout = support.LOOPBACK_TIMEOUT
def get_request(self):
request, client_addr = super().get_request()
@@ -220,7 +220,7 @@ if hasattr(socket, 'AF_UNIX'):
class UnixWSGIServer(UnixHTTPServer, WSGIServer):
- request_timeout = 2
+ request_timeout = support.LOOPBACK_TIMEOUT
def server_bind(self):
UnixHTTPServer.server_bind(self)