summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-05-24 00:56:00 +0200
committerGitHub <noreply@github.com>2018-05-24 00:56:00 +0200
commit2932755cc11fd82b4908d60b24b837aa4f3028e6 (patch)
treef76adca7ff648136ffb90a2ae4477b5c13649f54
parent529525fb5a8fd9b96ab4021311a598c77588b918 (diff)
downloadcpython-git-2932755cc11fd82b4908d60b24b837aa4f3028e6.tar.gz
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.
-rw-r--r--Lib/test/test_asyncio/test_events.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
index 66c77b976d..c9e39b2b03 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -2095,7 +2095,7 @@ class SubprocessTestsMixin:
class SendfileBase:
- DATA = b"12345abcde" * 160 * 1024 # 160 KiB
+ DATA = b"12345abcde" * 16 * 1024 # 160 KiB
@classmethod
def setUpClass(cls):
@@ -2208,7 +2208,7 @@ class SockSendfileMixin(SendfileBase):
self.assertEqual(self.file.tell(), 0)
def test_sock_sendfile_mix_with_regular_send(self):
- buf = b'1234567890' * 1024 * 1024 # 10 MB
+ buf = b"X" * 160 * 1024 # 160 KiB
sock, proto = self.prepare_socksendfile()
self.run_loop(self.loop.sock_sendall(sock, buf))
ret = self.run_loop(self.loop.sock_sendfile(sock, self.file))