summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2015-11-16 17:43:21 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2015-11-16 17:43:21 (GMT)
commit5bb1afb3322ecf370cf328d40fb95eb0a3ddab7c (patch)
tree6c9e387872b2ffb45429ee4c3e516f8b59c3b483 /Lib/test/test_asyncio
parentda32d26ab98cdb3fe27ee8d61460592fc1cae335 (diff)
downloadcpython-5bb1afb3322ecf370cf328d40fb95eb0a3ddab7c.zip
cpython-5bb1afb3322ecf370cf328d40fb95eb0a3ddab7c.tar.gz
cpython-5bb1afb3322ecf370cf328d40fb95eb0a3ddab7c.tar.bz2
asyncio: Add Transport.is_closing()
See https://github.com/python/asyncio/pull/291 for details.
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r--Lib/test/test_asyncio/test_proactor_events.py6
-rw-r--r--Lib/test/test_asyncio/test_selector_events.py6
-rw-r--r--Lib/test/test_asyncio/test_subprocess.py2
-rw-r--r--Lib/test/test_asyncio/test_unix_events.py12
4 files changed, 13 insertions, 13 deletions
diff --git a/Lib/test/test_asyncio/test_proactor_events.py b/Lib/test/test_asyncio/test_proactor_events.py
index fcd9ab1..5a0f088 100644
--- a/Lib/test/test_asyncio/test_proactor_events.py
+++ b/Lib/test/test_asyncio/test_proactor_events.py
@@ -204,7 +204,7 @@ class ProactorSocketTransportTests(test_utils.TestCase):
tr.close()
test_utils.run_briefly(self.loop)
self.protocol.connection_lost.assert_called_with(None)
- self.assertTrue(tr._closing)
+ self.assertTrue(tr.is_closing())
self.assertEqual(tr._conn_lost, 1)
self.protocol.connection_lost.reset_mock()
@@ -298,7 +298,7 @@ class ProactorSocketTransportTests(test_utils.TestCase):
self.loop, self.sock, self.protocol)
self.assertTrue(tr.can_write_eof())
tr.write_eof()
- self.assertTrue(tr._closing)
+ self.assertTrue(tr.is_closing())
self.loop._run_once()
self.assertTrue(self.sock.close.called)
tr.close()
@@ -309,7 +309,7 @@ class ProactorSocketTransportTests(test_utils.TestCase):
tr._loop._proactor.send.return_value = f
tr.write(b'data')
tr.write_eof()
- self.assertTrue(tr._closing)
+ self.assertTrue(tr.is_closing())
self.assertFalse(self.sock.shutdown.called)
tr._loop._proactor.send.assert_called_with(self.sock, b'data')
f.set_result(4)
diff --git a/Lib/test/test_asyncio/test_selector_events.py b/Lib/test/test_asyncio/test_selector_events.py
index f0fcdd2..135b5ab 100644
--- a/Lib/test/test_asyncio/test_selector_events.py
+++ b/Lib/test/test_asyncio/test_selector_events.py
@@ -698,7 +698,7 @@ class SelectorTransportTests(test_utils.TestCase):
tr = self.create_transport()
tr.close()
- self.assertTrue(tr._closing)
+ self.assertTrue(tr.is_closing())
self.assertEqual(1, self.loop.remove_reader_count[7])
self.protocol.connection_lost(None)
self.assertEqual(tr._conn_lost, 1)
@@ -723,7 +723,7 @@ class SelectorTransportTests(test_utils.TestCase):
self.loop.add_writer(7, mock.sentinel)
tr._force_close(None)
- self.assertTrue(tr._closing)
+ self.assertTrue(tr.is_closing())
self.assertEqual(tr._buffer, list_to_buffer())
self.assertFalse(self.loop.readers)
self.assertFalse(self.loop.writers)
@@ -1436,7 +1436,7 @@ class SelectorSslTransportTests(test_utils.TestCase):
tr = self._make_one()
tr.close()
- self.assertTrue(tr._closing)
+ self.assertTrue(tr.is_closing())
self.assertEqual(1, self.loop.remove_reader_count[1])
self.assertEqual(tr._conn_lost, 1)
diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py
index 38f0cee..e90f17d 100644
--- a/Lib/test/test_asyncio/test_subprocess.py
+++ b/Lib/test/test_asyncio/test_subprocess.py
@@ -61,7 +61,7 @@ class SubprocessTransportTests(test_utils.TestCase):
self.assertTrue(protocol.connection_lost.called)
self.assertEqual(protocol.connection_lost.call_args[0], (None,))
- self.assertFalse(transport._closed)
+ self.assertFalse(transport.is_closing())
self.assertIsNone(transport._loop)
self.assertIsNone(transport._proc)
self.assertIsNone(transport._protocol)
diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py
index dc0835c..22dc688 100644
--- a/Lib/test/test_asyncio/test_unix_events.py
+++ b/Lib/test/test_asyncio/test_unix_events.py
@@ -440,7 +440,7 @@ class UnixReadPipeTransportTests(test_utils.TestCase):
tr = self.read_pipe_transport()
err = object()
tr._close(err)
- self.assertTrue(tr._closing)
+ self.assertTrue(tr.is_closing())
self.assertFalse(self.loop.readers)
test_utils.run_briefly(self.loop)
self.protocol.connection_lost.assert_called_with(err)
@@ -598,7 +598,7 @@ class UnixWritePipeTransportTests(test_utils.TestCase):
tr._read_ready()
self.assertFalse(self.loop.readers)
self.assertFalse(self.loop.writers)
- self.assertTrue(tr._closing)
+ self.assertTrue(tr.is_closing())
test_utils.run_briefly(self.loop)
self.protocol.connection_lost.assert_called_with(None)
@@ -658,7 +658,7 @@ class UnixWritePipeTransportTests(test_utils.TestCase):
self.assertFalse(self.loop.writers)
self.assertFalse(self.loop.readers)
self.assertEqual([], tr._buffer)
- self.assertTrue(tr._closing)
+ self.assertTrue(tr.is_closing())
m_logexc.assert_called_with(
test_utils.MockPattern(
'Fatal write error on pipe transport'
@@ -694,7 +694,7 @@ class UnixWritePipeTransportTests(test_utils.TestCase):
self.assertFalse(self.loop.readers)
self.assertFalse(self.loop.writers)
self.assertEqual([], tr._buffer)
- self.assertTrue(tr._closing)
+ self.assertTrue(tr.is_closing())
test_utils.run_briefly(self.loop)
self.protocol.connection_lost.assert_called_with(None)
@@ -743,7 +743,7 @@ class UnixWritePipeTransportTests(test_utils.TestCase):
def test_write_eof(self):
tr = self.write_pipe_transport()
tr.write_eof()
- self.assertTrue(tr._closing)
+ self.assertTrue(tr.is_closing())
self.assertFalse(self.loop.readers)
test_utils.run_briefly(self.loop)
self.protocol.connection_lost.assert_called_with(None)
@@ -752,7 +752,7 @@ class UnixWritePipeTransportTests(test_utils.TestCase):
tr = self.write_pipe_transport()
tr._buffer = [b'data']
tr.write_eof()
- self.assertTrue(tr._closing)
+ self.assertTrue(tr.is_closing())
self.assertFalse(self.protocol.connection_lost.called)