summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
authorGuido van Rossum <guido@dropbox.com>2013-10-18 14:58:20 (GMT)
committerGuido van Rossum <guido@dropbox.com>2013-10-18 14:58:20 (GMT)
commit57497ad1810304ef74774fb1abd379dec80f458b (patch)
tree1696f5389cdad967002eff56160765936aba9010 /Lib/test/test_asyncio
parent40b22d0661c45ac350a7252a32ef665b81b1643c (diff)
downloadcpython-57497ad1810304ef74774fb1abd379dec80f458b.zip
cpython-57497ad1810304ef74774fb1abd379dec80f458b.tar.gz
cpython-57497ad1810304ef74774fb1abd379dec80f458b.tar.bz2
Rename Transport.pause/resume to pause_reading/pause_writing. Also relax timeout in test_call_later().
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r--Lib/test/test_asyncio/test_events.py2
-rw-r--r--Lib/test/test_asyncio/test_proactor_events.py6
-rw-r--r--Lib/test/test_asyncio/test_selector_events.py12
-rw-r--r--Lib/test/test_asyncio/test_transports.py4
-rw-r--r--Lib/test/test_asyncio/test_unix_events.py8
5 files changed, 16 insertions, 16 deletions
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
index a9a9271..2e89f72 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -238,7 +238,7 @@ class EventLoopTestsMixin:
self.loop.run_forever()
t1 = time.monotonic()
self.assertEqual(results, ['hello world'])
- self.assertTrue(0.09 <= t1-t0 <= 0.12, t1-t0)
+ self.assertTrue(0.08 <= t1-t0 <= 0.2, t1-t0)
def test_call_soon(self):
results = []
diff --git a/Lib/test/test_asyncio/test_proactor_events.py b/Lib/test/test_asyncio/test_proactor_events.py
index e4dd609..05d1606 100644
--- a/Lib/test/test_asyncio/test_proactor_events.py
+++ b/Lib/test/test_asyncio/test_proactor_events.py
@@ -308,7 +308,7 @@ class ProactorSocketTransportTests(unittest.TestCase):
tr.write_eof()
tr.close()
- def test_pause_resume(self):
+ def test_pause_resume_reading(self):
tr = _ProactorSocketTransport(
self.loop, self.sock, self.protocol)
futures = []
@@ -323,12 +323,12 @@ class ProactorSocketTransportTests(unittest.TestCase):
self.protocol.data_received.assert_called_with(b'data1')
self.loop._run_once()
self.protocol.data_received.assert_called_with(b'data2')
- tr.pause()
+ tr.pause_reading()
self.assertTrue(tr._paused)
for i in range(10):
self.loop._run_once()
self.protocol.data_received.assert_called_with(b'data2')
- tr.resume()
+ tr.resume_reading()
self.assertFalse(tr._paused)
self.loop._run_once()
self.protocol.data_received.assert_called_with(b'data3')
diff --git a/Lib/test/test_asyncio/test_selector_events.py b/Lib/test/test_asyncio/test_selector_events.py
index 1465cd2..53728b8 100644
--- a/Lib/test/test_asyncio/test_selector_events.py
+++ b/Lib/test/test_asyncio/test_selector_events.py
@@ -676,15 +676,15 @@ class SelectorSocketTransportTests(unittest.TestCase):
test_utils.run_briefly(self.loop)
self.assertIsNone(fut.result())
- def test_pause_resume(self):
+ def test_pause_resume_reading(self):
tr = _SelectorSocketTransport(
self.loop, self.sock, self.protocol)
self.assertFalse(tr._paused)
self.loop.assert_reader(7, tr._read_ready)
- tr.pause()
+ tr.pause_reading()
self.assertTrue(tr._paused)
self.assertFalse(7 in self.loop.readers)
- tr.resume()
+ tr.resume_reading()
self.assertFalse(tr._paused)
self.loop.assert_reader(7, tr._read_ready)
@@ -1044,14 +1044,14 @@ class SelectorSslTransportTests(unittest.TestCase):
self.assertTrue(transport._waiter.done())
self.assertIs(exc, transport._waiter.exception())
- def test_pause_resume(self):
+ def test_pause_resume_reading(self):
tr = self._make_one()
self.assertFalse(tr._paused)
self.loop.assert_reader(1, tr._on_ready)
- tr.pause()
+ tr.pause_reading()
self.assertTrue(tr._paused)
self.assertFalse(1 in self.loop.readers)
- tr.resume()
+ tr.resume_reading()
self.assertFalse(tr._paused)
self.loop.assert_reader(1, tr._on_ready)
diff --git a/Lib/test/test_asyncio/test_transports.py b/Lib/test/test_asyncio/test_transports.py
index fce2e6f..53071af 100644
--- a/Lib/test/test_asyncio/test_transports.py
+++ b/Lib/test/test_asyncio/test_transports.py
@@ -33,8 +33,8 @@ class TransportTests(unittest.TestCase):
self.assertRaises(NotImplementedError, transport.write, 'data')
self.assertRaises(NotImplementedError, transport.write_eof)
self.assertRaises(NotImplementedError, transport.can_write_eof)
- self.assertRaises(NotImplementedError, transport.pause)
- self.assertRaises(NotImplementedError, transport.resume)
+ self.assertRaises(NotImplementedError, transport.pause_reading)
+ self.assertRaises(NotImplementedError, transport.resume_reading)
self.assertRaises(NotImplementedError, transport.close)
self.assertRaises(NotImplementedError, transport.abort)
diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py
index 227366d..ccabeea 100644
--- a/Lib/test/test_asyncio/test_unix_events.py
+++ b/Lib/test/test_asyncio/test_unix_events.py
@@ -375,21 +375,21 @@ class UnixReadPipeTransportTests(unittest.TestCase):
m_logexc.assert_called_with('Fatal error for %s', tr)
@unittest.mock.patch('os.read')
- def test_pause(self, m_read):
+ def test_pause_reading(self, m_read):
tr = unix_events._UnixReadPipeTransport(
self.loop, self.pipe, self.protocol)
m = unittest.mock.Mock()
self.loop.add_reader(5, m)
- tr.pause()
+ tr.pause_reading()
self.assertFalse(self.loop.readers)
@unittest.mock.patch('os.read')
- def test_resume(self, m_read):
+ def test_resume_reading(self, m_read):
tr = unix_events._UnixReadPipeTransport(
self.loop, self.pipe, self.protocol)
- tr.resume()
+ tr.resume_reading()
self.loop.assert_reader(5, tr._read_ready)
@unittest.mock.patch('os.read')