summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2019-06-12 18:50:23 (GMT)
committerGitHub <noreply@github.com>2019-06-12 18:50:23 (GMT)
commit0d1942774a70d561dbaaa980742dd0927e8aa51a (patch)
tree7b7decc710617f6e0ee1b1a1ca5d08f3ccb9c939
parentff6bb0aa95259413f359d42410526ff0b4dccfb7 (diff)
downloadcpython-0d1942774a70d561dbaaa980742dd0927e8aa51a.zip
cpython-0d1942774a70d561dbaaa980742dd0927e8aa51a.tar.gz
cpython-0d1942774a70d561dbaaa980742dd0927e8aa51a.tar.bz2
Make asyncio stream sendfile fail on error (was hang) (GH-14025)
-rw-r--r--Lib/test/test_asyncio/test_streams.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py
index 74e3855..a1c62ec 100644
--- a/Lib/test/test_asyncio/test_streams.py
+++ b/Lib/test/test_asyncio/test_streams.py
@@ -1656,22 +1656,25 @@ os.close(fd)
async def serve_callback(stream):
data = await stream.readline()
- self.assertEqual(data, b'begin\n')
+ await stream.write(b'ack-' + data)
data = await stream.readline()
- self.assertEqual(data, b'data\n')
+ await stream.write(b'ack-' + data)
data = await stream.readline()
- self.assertEqual(data, b'end\n')
- await stream.write(b'done\n')
+ await stream.write(b'ack-' + data)
await stream.close()
async def do_connect(host, port):
stream = await asyncio.connect(host, port)
await stream.write(b'begin\n')
+ data = await stream.readline()
+ self.assertEqual(b'ack-begin\n', data)
with open(support.TESTFN, 'rb') as fp:
await stream.sendfile(fp)
+ data = await stream.readline()
+ self.assertEqual(b'ack-data\n', data)
await stream.write(b'end\n')
data = await stream.readline()
- self.assertEqual(data, b'done\n')
+ self.assertEqual(data, b'ack-end\n')
await stream.close()
async def test():