summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
authorJ. Nick Koston <nick@koston.org>2024-12-06 04:33:03 (GMT)
committerGitHub <noreply@github.com>2024-12-06 04:33:03 (GMT)
commite991ac8f2037d78140e417cc9a9486223eb3e786 (patch)
treebd25bcf8877e1efa749fc84b6934f465ed062287 /Lib/test/test_asyncio
parent25eee578c8e369b027da6d9d2725f29df6ef1cbd (diff)
downloadcpython-e991ac8f2037d78140e417cc9a9486223eb3e786.zip
cpython-e991ac8f2037d78140e417cc9a9486223eb3e786.tar.gz
cpython-e991ac8f2037d78140e417cc9a9486223eb3e786.tar.bz2
gh-127655: Ensure `_SelectorSocketTransport.writelines` pauses the protocol if needed (#127656)
Ensure `_SelectorSocketTransport.writelines` pauses the protocol if it reaches the high water mark as needed. Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r--Lib/test/test_asyncio/test_selector_events.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_selector_events.py b/Lib/test/test_asyncio/test_selector_events.py
index aaeda33..efca30f 100644
--- a/Lib/test/test_asyncio/test_selector_events.py
+++ b/Lib/test/test_asyncio/test_selector_events.py
@@ -805,6 +805,18 @@ class SelectorSocketTransportTests(test_utils.TestCase):
self.assertTrue(self.sock.send.called)
self.assertTrue(self.loop.writers)
+ def test_writelines_pauses_protocol(self):
+ data = memoryview(b'data')
+ self.sock.send.return_value = 2
+ self.sock.send.fileno.return_value = 7
+
+ transport = self.socket_transport()
+ transport._high_water = 1
+ transport.writelines([data])
+ self.assertTrue(self.protocol.pause_writing.called)
+ self.assertTrue(self.sock.send.called)
+ self.assertTrue(self.loop.writers)
+
@unittest.skipUnless(selector_events._HAS_SENDMSG, 'no sendmsg')
def test_write_sendmsg_full(self):
data = memoryview(b'data')