File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,9 @@ Bugs fixed
90
90
Patch by Bénédikt Tran.
91
91
* #12008: Fix case-sensitive lookup of ``std:label `` names in intersphinx inventory.
92
92
Patch by Michael Goerz.
93
+ * #12038: Resolve ``linkcheck `` unit test timeouts on Windows by adding a readiness
94
+ check to the test HTTP(S) server setup code.
95
+ Patch by James Addison.
93
96
94
97
Testing
95
98
-------
Original file line number Diff line number Diff line change 1
1
import contextlib
2
2
import http .server
3
3
import pathlib
4
+ import socket
4
5
import threading
5
6
from ssl import PROTOCOL_TLS_SERVER , SSLContext
6
7
15
16
# File lock for tests
16
17
LOCK_PATH = str (TESTS_ROOT / 'test-server.lock' )
17
18
19
+ HOST_NAME = "localhost"
20
+ HOST_PORT = 7777
21
+ ADDRESS = (HOST_NAME , HOST_PORT )
22
+
18
23
19
24
class HttpServerThread (threading .Thread ):
20
25
def __init__ (self , handler , * args , ** kwargs ):
21
26
super ().__init__ (* args , ** kwargs )
22
- self .server = http .server .ThreadingHTTPServer (( "localhost" , 7777 ) , handler )
27
+ self .server = http .server .ThreadingHTTPServer (ADDRESS , handler )
23
28
24
29
def run (self ):
25
30
self .server .serve_forever (poll_interval = 0.001 )
@@ -45,7 +50,8 @@ def server(handler):
45
50
server_thread = thread_class (handler , daemon = True )
46
51
server_thread .start ()
47
52
try :
48
- yield server_thread
53
+ socket .create_connection (ADDRESS , timeout = 0.5 ).close () # Attempt connection.
54
+ yield server_thread # Connection has been confirmed possible; proceed.
49
55
finally :
50
56
server_thread .terminate ()
51
57
return contextlib .contextmanager (server )
You can’t perform that action at this time.
0 commit comments