[Python-checkins] cpython: Issue #20452: test_asyncio checks also the granularity

victor.stinner python-checkins at python.org
Sat Feb 1 02:22:31 CET 2014


http://hg.python.org/cpython/rev/a090804862f8
changeset:   88871:a090804862f8
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sat Feb 01 02:17:54 2014 +0100
summary:
  Issue #20452: test_asyncio checks also the granularity

files:
  Lib/test/test_asyncio/test_events.py |  8 ++++++++
  1 files changed, 8 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -1179,6 +1179,14 @@
         calls.append(self.loop._run_once_counter)
         self.assertEqual(calls, [1, 3, 5, 6])
 
+    def test_granularity(self):
+        granularity = self.loop._granularity
+        self.assertGreater(granularity, 0.0)
+        # Worst expected granularity: 1 ms on Linux (limited by poll/epoll
+        # resolution), 15.6 ms on Windows (limited by time.monotonic
+        # resolution)
+        self.assertLess(granularity, 0.050)
+
 
 class SubprocessTestsMixin:
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list