[Python-checkins] cpython (3.4): asyncio: Fix with github

yury.selivanov python-checkins at python.org
Fri Nov 20 12:58:08 EST 2015


https://hg.python.org/cpython/rev/0ef231a868ef
changeset:   99242:0ef231a868ef
branch:      3.4
parent:      99239:9bd5d2ed436a
user:        Yury Selivanov <yselivanov at sprymix.com>
date:        Fri Nov 20 12:57:34 2015 -0500
summary:
  asyncio: Fix with github

See https://github.com/python/asyncio/pull/295 for details

files:
  Lib/asyncio/test_utils.py                 |  11 +++++++++++
  Lib/test/test_asyncio/test_base_events.py |   7 ++++---
  2 files changed, 15 insertions(+), 3 deletions(-)


diff --git a/Lib/asyncio/test_utils.py b/Lib/asyncio/test_utils.py
--- a/Lib/asyncio/test_utils.py
+++ b/Lib/asyncio/test_utils.py
@@ -24,6 +24,7 @@
     ssl = None
 
 from . import base_events
+from . import compat
 from . import events
 from . import futures
 from . import selectors
@@ -421,6 +422,16 @@
         # in an except block of a generator
         self.assertEqual(sys.exc_info(), (None, None, None))
 
+    if not compat.PY34:
+        # Python 3.3 compatibility
+        def subTest(self, *args, **kwargs):
+            class EmptyCM:
+                def __enter__(self):
+                    pass
+                def __exit__(self, *exc):
+                    pass
+            return EmptyCM()
+
 
 @contextlib.contextmanager
 def disable_logger():
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
@@ -782,9 +782,10 @@
         self.loop._selector.select.return_value = (event_sentinel,)
 
         for i in range(1, 3):
-            self.loop.call_soon(self.loop.stop)
-            self.loop.run_forever()
-            self.assertEqual(callcount, 1)
+            with self.subTest('Loop %d/2' % i):
+                self.loop.call_soon(self.loop.stop)
+                self.loop.run_forever()
+                self.assertEqual(callcount, 1)
 
     def test_run_once(self):
         # Simple test for test_utils.run_once().  It may seem strange

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


More information about the Python-checkins mailing list