Skip to content

Commit 85ffe07

Browse files
author
rodrigo.nogueira
committed
fix: increase Windows cleanup delay to 0.5s with multiple gc passes
The 0.1s delay was insufficient for proxy.py worker threads to release their sockets. Increased to 0.5s and added 3 gc.collect() passes to ensure all cyclic references are broken before pytest cleanup.
1 parent 00d8bab commit 85ffe07

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

tests/test_proxy_functional.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,16 @@ def secure_proxy_url(tls_certificate_pem_path: str) -> Iterator[URL]:
9191

9292
# On Windows, proxy.py uses threaded mode which can leave sockets in
9393
# a state where they haven't been fully released when GC runs during
94-
# pytest cleanup. A short delay + explicit gc.collect() ensures the
95-
# proxy threads finish cleanup before pytest's unraisableexception
94+
# pytest cleanup. A longer delay + multiple gc.collect() passes ensures
95+
# the proxy threads finish cleanup before pytest's unraisableexception
9696
# plugin collects warnings.
9797
if os.name == "nt":
9898
import gc
9999
import time
100100

101-
time.sleep(0.1)
101+
time.sleep(0.5)
102+
gc.collect()
103+
gc.collect()
102104
gc.collect()
103105

104106

0 commit comments

Comments
 (0)