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
9090 Patch by Bénédikt Tran.
9191* #12008: Fix case-sensitive lookup of ``std:label `` names in intersphinx inventory.
9292 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.
9396
9497Testing
9598-------
Original file line number Diff line number Diff line change 11import contextlib
22import http .server
33import pathlib
4+ import socket
45import threading
56from ssl import PROTOCOL_TLS_SERVER , SSLContext
67
1516# File lock for tests
1617LOCK_PATH = str (TESTS_ROOT / 'test-server.lock' )
1718
19+ HOST_NAME = "localhost"
20+ HOST_PORT = 7777
21+ ADDRESS = (HOST_NAME , HOST_PORT )
22+
1823
1924class HttpServerThread (threading .Thread ):
2025 def __init__ (self , handler , * args , ** kwargs ):
2126 super ().__init__ (* args , ** kwargs )
22- self .server = http .server .ThreadingHTTPServer (( "localhost" , 7777 ) , handler )
27+ self .server = http .server .ThreadingHTTPServer (ADDRESS , handler )
2328
2429 def run (self ):
2530 self .server .serve_forever (poll_interval = 0.001 )
@@ -45,7 +50,8 @@ def server(handler):
4550 server_thread = thread_class (handler , daemon = True )
4651 server_thread .start ()
4752 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.
4955 finally :
5056 server_thread .terminate ()
5157 return contextlib .contextmanager (server )
You can’t perform that action at this time.
0 commit comments