summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_socket.py5
-rw-r--r--Misc/NEWS.d/next/Tests/2019-02-26-12-51-35.bpo-36123.QRhhRS.rst1
2 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 7c5167d..571f45c 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -5603,7 +5603,7 @@ class SendfileUsingSendTest(ThreadedTCPSocketTest):
support.unlink(support.TESTFN)
def accept_conn(self):
- self.serv.settimeout(self.TIMEOUT)
+ self.serv.settimeout(MAIN_TIMEOUT)
conn, addr = self.serv.accept()
conn.settimeout(self.TIMEOUT)
self.addCleanup(conn.close)
@@ -5788,7 +5788,8 @@ class SendfileUsingSendTest(ThreadedTCPSocketTest):
def _testWithTimeoutTriggeredSend(self):
address = self.serv.getsockname()
with open(support.TESTFN, 'rb') as file:
- with socket.create_connection(address, timeout=0.01) as sock:
+ with socket.create_connection(address) as sock:
+ sock.settimeout(0.01)
meth = self.meth_from_sock(sock)
self.assertRaises(socket.timeout, meth, file)
diff --git a/Misc/NEWS.d/next/Tests/2019-02-26-12-51-35.bpo-36123.QRhhRS.rst b/Misc/NEWS.d/next/Tests/2019-02-26-12-51-35.bpo-36123.QRhhRS.rst
new file mode 100644
index 0000000..5a7e5bb
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2019-02-26-12-51-35.bpo-36123.QRhhRS.rst
@@ -0,0 +1 @@
+Fix race condition in test_socket. \ No newline at end of file