[Python-checkins] cpython: Issue #20452: add more info in case of test_asyncio failure to try to debug the
victor.stinner
python-checkins at python.org
Fri Jan 31 09:37:37 CET 2014
http://hg.python.org/cpython/rev/5545634d98a1
changeset: 88843:5545634d98a1
parent: 88841:c30a3a6f3b39
user: Victor Stinner <victor.stinner at gmail.com>
date: Fri Jan 31 09:29:35 2014 +0100
summary:
Issue #20452: add more info in case of test_asyncio failure to try to debug the
failure on buildbot "x86 Ubuntu Shared 3.x"
files:
Lib/asyncio/base_events.py | 10 +++++++++-
Lib/test/test_asyncio/test_events.py | 11 ++++++++++-
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -620,10 +620,18 @@
timeout = min(timeout, deadline)
# TODO: Instrumentation only in debug mode?
- if logger.isEnabledFor(logging.INFO):
+ # FIXME: don't force log (issue #20452)
+ if True: #logger.isEnabledFor(logging.INFO):
t0 = self.time()
event_list = self._selector.select(timeout)
t1 = self.time()
+ # FIXME: remove these debug info (issue #20452)
+ dt = t1-t0
+ if dt < timeout and not event_list:
+ print("WARNING: selector.select(timeout=%.20f) took dt=%.20f sec (dt-timeout=%+.20f)"
+ % (timeout, dt, dt-timeout), file=sys.__stdout__)
+ print("WARNING: dt+%.20f > timeout? %s"
+ % (self._granularity, (dt + self._granularity) > timeout), file=sys.__stdout__)
if t1-t0 >= 1:
level = logging.INFO
else:
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
@@ -1157,6 +1157,10 @@
w.close()
def test_timeout_rounding(self):
+ # FIXME: remove this imports, used for debug purpose (issue #20452)
+ import time
+ import platform
+
def _run_once():
self.loop._run_once_counter += 1
orig_run_once()
@@ -1177,7 +1181,12 @@
self.loop.run_until_complete(wait())
calls.append(self.loop._run_once_counter)
- self.assertEqual(calls, [1, 3, 5, 6])
+ self.assertEqual(calls, [1, 3, 5, 6],
+ # FIXME: remove these info, used for debug purpose (issue #20452)
+ (self.loop._granularity,
+ self.loop._selector.resolution,
+ time.get_clock_info('monotonic'),
+ platform.platform()))
class SubprocessTestsMixin:
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list