https://github.com/python/cpython/commit/abab65540c164efc4bde04c0bb690473c625ed4f
commit: abab65540c164efc4bde04c0bb690473c625ed4f
branch: 3.14
author: Petr Viktorin <[email protected]>
committer: zware <[email protected]>
date: 2026-09-02T12:43:43-05:00
summary:
[3.14] gh-119452: test_large_content_length_truncated: Don't use the full
LOOPBACK_TIMEOUT on Windows (GH-156761)
This is a follow-up to GH-155951 (commit
39921ebf7007a7fe3181bbebcf64d4433ec5de7a)
files:
M Lib/test/test_httpservers.py
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py
index aa496b9d455e0e..e8ff4b94f8ba79 100644
--- a/Lib/test/test_httpservers.py
+++ b/Lib/test/test_httpservers.py
@@ -1134,7 +1134,16 @@ def test_large_content_length(self):
self.assertEqual(res.read(), b'%d %d' % (size, size) +
self.linesep)
def test_large_content_length_truncated(self):
- with support.swap_attr(self.request_handler, 'timeout',
support.LOOPBACK_TIMEOUT):
+ timeout = support.LOOPBACK_TIMEOUT
+ if not hasattr(os, 'fork'):
+ # On Windows, request() waits for the entire timeout; the default
+ # LOOPBACK_TIMEOUT (10s) is too long for 40 repetitions.
+ # Use a fraction of that (for slow machines), or .001 (in case
+ # LOOPBACK_TIMEOUT is configured to be smaller).
+ timeout = max(timeout / 100, 0.001)
+ # (On Unix, request() returns early so a large LOOPBACK_TIMEOUT
+ # isn't an issue.)
+ with support.swap_attr(self.request_handler, 'timeout', timeout):
for w in range(18, 65):
size = 1 << w
headers = {'Content-Length' : str(size)}
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]