summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_unix_events.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-09-29 12:19:11 (GMT)
committerGitHub <noreply@github.com>2019-09-29 12:19:11 (GMT)
commit1c3e4691bb41fa070d6f4836cb03005123e53e4b (patch)
tree5faecc459a524f8159fe5350676b4b01d8d84108 /Lib/test/test_asyncio/test_unix_events.py
parent80dd66ac278ecbabbf843526e3a56f5031da9562 (diff)
downloadcpython-1c3e4691bb41fa070d6f4836cb03005123e53e4b.zip
cpython-1c3e4691bb41fa070d6f4836cb03005123e53e4b.tar.gz
cpython-1c3e4691bb41fa070d6f4836cb03005123e53e4b.tar.bz2
bpo-38019: correctly handle pause/resume reading of closed asyncio unix pipe (GH-16472)
(cherry picked from commit 58498bc7178608b1ab031994ca09c43889ce3e76) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Diffstat (limited to 'Lib/test/test_asyncio/test_unix_events.py')
-rw-r--r--Lib/test/test_asyncio/test_unix_events.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py
index ec171fa..66a6bc1 100644
--- a/Lib/test/test_asyncio/test_unix_events.py
+++ b/Lib/test/test_asyncio/test_unix_events.py
@@ -722,6 +722,7 @@ class UnixReadPipeTransportTests(test_utils.TestCase):
@mock.patch('os.read')
def test_resume_reading(self, m_read):
tr = self.read_pipe_transport()
+ tr.pause_reading()
tr.resume_reading()
self.loop.assert_reader(5, tr._read_ready)
@@ -776,6 +777,32 @@ class UnixReadPipeTransportTests(test_utils.TestCase):
self.assertIsNone(tr._protocol)
self.assertIsNone(tr._loop)
+ def test_pause_reading_on_closed_pipe(self):
+ tr = self.read_pipe_transport()
+ tr.close()
+ test_utils.run_briefly(self.loop)
+ self.assertIsNone(tr._loop)
+ tr.pause_reading()
+
+ def test_pause_reading_on_paused_pipe(self):
+ tr = self.read_pipe_transport()
+ tr.pause_reading()
+ # the second call should do nothing
+ tr.pause_reading()
+
+ def test_resume_reading_on_closed_pipe(self):
+ tr = self.read_pipe_transport()
+ tr.close()
+ test_utils.run_briefly(self.loop)
+ self.assertIsNone(tr._loop)
+ tr.resume_reading()
+
+ def test_resume_reading_on_paused_pipe(self):
+ tr = self.read_pipe_transport()
+ # the pipe is not paused
+ # resuming should do nothing
+ tr.resume_reading()
+
class UnixWritePipeTransportTests(test_utils.TestCase):