Skip to content

Commit 75d88b9

Browse files
bpo-41682: fixed flaky test test_sendfile_close_peer_in_the_middle_of_receiving (GH-30845) (#30860)
(cherry picked from commit 1c705fd) Co-authored-by: Kumar Aditya <[email protected]> Co-authored-by: Kumar Aditya <[email protected]>
1 parent 9a7d010 commit 75d88b9

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Lib/test/test_asyncio/test_sendfile.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,13 @@ async def wait_closed(self):
9292

9393
class SendfileBase:
9494

95-
# 128 KiB plus small unaligned to buffer chunk
96-
DATA = b"SendfileBaseData" * (1024 * 8 + 1)
97-
95+
# 256 KiB plus small unaligned to buffer chunk
96+
# Newer versions of Windows seems to have increased its internal
97+
# buffer and tries to send as much of the data as it can as it
98+
# has some form of buffering for this which is less than 256KiB
99+
# on newer server versions and Windows 11.
100+
# So DATA should be larger than 256 KiB to make this test reliable.
101+
DATA = b"x" * (1024 * 256 + 1)
98102
# Reduce socket buffer size to test on relative small data sets.
99103
BUF_SIZE = 4 * 1024 # 4 KiB
100104

@@ -456,8 +460,6 @@ def test_sendfile_ssl_close_peer_after_receiving(self):
456460
# themselves).
457461
@unittest.skipIf(sys.platform.startswith('sunos'),
458462
"Doesn't work on Solaris")
459-
@unittest.skipIf(sys.platform == "win32",
460-
"It is flaky on Windows and needs to be fixed") # TODO: bpo-41682
461463
def test_sendfile_close_peer_in_the_middle_of_receiving(self):
462464
srv_proto, cli_proto = self.prepare_sendfile(close_after=1024)
463465
with self.assertRaises(ConnectionError):

0 commit comments

Comments
 (0)