Skip to content

Commit 2932755

Browse files
authored
bpo-33353: test_asyncio uses smaller sendfile data (#7083)
bpo-32622, bpo-33353: sendfile() tests of test_asyncio use socket buffers of 1 kB "to test on relative small data sets". Send only 160 KiB rather 10 MB to make the test much faster. Shrink also SendfileBase.DATA from 1600 KiB to 160 KiB. On Linux, 3 test_sock_sendfile_mix_with_regular_send() runs now take less than 1 second, instead of 18 seconds. On FreeBSD, the 3 tests didn't hang, but took 3 minutes. Now the 3 tests pass in less than 1 seconds.
1 parent 529525f commit 2932755

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/test/test_asyncio/test_events.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2095,7 +2095,7 @@ async def connect(cmd=None, **kwds):
20952095

20962096
class SendfileBase:
20972097

2098-
DATA = b"12345abcde" * 160 * 1024 # 160 KiB
2098+
DATA = b"12345abcde" * 16 * 1024 # 160 KiB
20992099

21002100
@classmethod
21012101
def setUpClass(cls):
@@ -2208,7 +2208,7 @@ def test_sock_sendfile_zero_size(self):
22082208
self.assertEqual(self.file.tell(), 0)
22092209

22102210
def test_sock_sendfile_mix_with_regular_send(self):
2211-
buf = b'1234567890' * 1024 * 1024 # 10 MB
2211+
buf = b"X" * 160 * 1024 # 160 KiB
22122212
sock, proto = self.prepare_socksendfile()
22132213
self.run_loop(self.loop.sock_sendall(sock, buf))
22142214
ret = self.run_loop(self.loop.sock_sendfile(sock, self.file))

0 commit comments

Comments
 (0)