summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_base_events.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-02-01 21:49:59 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-02-01 21:49:59 (GMT)
commit915bcb01110c7db65f8be9139bf887c749fbde75 (patch)
treefa24b947b19c1479ed581dc817c2e696386f3fb0 /Lib/test/test_asyncio/test_base_events.py
parent153d97b24e7253f344860094eb2c98ed93657720 (diff)
downloadcpython-915bcb01110c7db65f8be9139bf887c749fbde75.zip
cpython-915bcb01110c7db65f8be9139bf887c749fbde75.tar.gz
cpython-915bcb01110c7db65f8be9139bf887c749fbde75.tar.bz2
Issue #20400: Merge Tulip into Python: add the new asyncio.subprocess module
* Add a new asyncio.subprocess module * Add new create_subprocess_exec() and create_subprocess_shell() functions * The new asyncio.subprocess.SubprocessStreamProtocol creates stream readers for stdout and stderr and a stream writer for stdin. * The new asyncio.subprocess.Process class offers an API close to the subprocess.Popen class: - pid, returncode, stdin, stdout and stderr attributes - communicate(), wait(), send_signal(), terminate() and kill() methods * Remove STDIN (0), STDOUT (1) and STDERR (2) constants from base_subprocess and unix_events, to not be confused with the symbols with the same name of subprocess and asyncio.subprocess modules * _ProactorBasePipeTransport.get_write_buffer_size() now counts also the size of the pending write * _ProactorBaseWritePipeTransport._loop_writing() may now pause the protocol if the write buffer size is greater than the high water mark (64 KB by default)
Diffstat (limited to 'Lib/test/test_asyncio/test_base_events.py')
-rw-r--r--Lib/test/test_asyncio/test_base_events.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
index 1db7723..72f5c8a 100644
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
@@ -116,18 +116,17 @@ class BaseEventLoopTests(unittest.TestCase):
self.loop.stop()
self.loop._process_events = unittest.mock.Mock()
- delay = 0.1
-
- when = self.loop.time() + delay
+ when = self.loop.time() + 0.1
self.loop.call_at(when, cb)
t0 = self.loop.time()
self.loop.run_forever()
dt = self.loop.time() - t0
-
- self.assertGreaterEqual(dt, delay - self.loop._granularity, dt)
- # tolerate a difference of +800 ms because some Python buildbots
- # are really slow
- self.assertLessEqual(dt, 0.9, dt)
+ self.assertTrue(0.09 <= dt <= 0.9,
+ # Issue #20452: add more info in case of failure,
+ # to try to investigate the bug
+ (dt,
+ self.loop._granularity,
+ time.get_clock_info('monotonic')))
def test_run_once_in_executor_handle(self):
def cb():