Skip to content

Commit 447975f

Browse files
Python 3.14 updated the DEFAULT_BUFFER_SIZE to be larger
This broke the test that assumed it would be 8192. Fix things so that the tests now correctly test things again.
1 parent 7121e8c commit 447975f

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

tests/test_in_wsgiref.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import cgi
2+
from io import DEFAULT_BUFFER_SIZE
23
import logging
34
import socket
45
import sys
@@ -13,6 +14,8 @@
1314

1415
log = logging.getLogger(__name__)
1516

17+
TARGET_CL = DEFAULT_BUFFER_SIZE * 2
18+
1619

1720
@pytest.mark.usefixtures("serve")
1821
def test_request_reading(serve):
@@ -64,7 +67,7 @@ def test_interrupted_request(serve):
6467

6568

6669
def _test_app_req_interrupt(env, sr):
67-
target_cl = 100000
70+
target_cl = TARGET_CL
6871
try:
6972
req = Request(env)
7073
cl = req.content_length
@@ -94,7 +97,7 @@ def _req_int_cgi(req):
9497
def _req_int_readline(req):
9598
try:
9699
assert req.body_file.readline() == b"a=b\n"
97-
except OSError:
100+
except OSError as exc:
98101
# too early to detect disconnect
99102
raise AssertionError("False disconnect alert")
100103
req.body_file.readline()
@@ -126,7 +129,7 @@ def _send_interrupted_req(server, path="/"):
126129
_interrupted_req = (
127130
"POST %s HTTP/1.0\r\n"
128131
"content-type: application/x-www-form-urlencoded\r\n"
129-
"content-length: 100000\r\n"
132+
f"content-length: {TARGET_CL}\r\n"
130133
"\r\n"
131134
)
132-
_interrupted_req += "a=b\nz=" + "x" * 10000
135+
_interrupted_req += "a=b\nz=" + "x" * DEFAULT_BUFFER_SIZE

0 commit comments

Comments
 (0)