]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
asyncio: Fix with github
authorYury Selivanov <yselivanov@sprymix.com>
Fri, 20 Nov 2015 17:57:34 +0000 (12:57 -0500)
committerYury Selivanov <yselivanov@sprymix.com>
Fri, 20 Nov 2015 17:57:34 +0000 (12:57 -0500)
See https://github.com/python/asyncio/pull/295 for details

Lib/asyncio/test_utils.py
Lib/test/test_asyncio/test_base_events.py

index e06ac06eee33ea128ead6b08c32e74cae4344637..8170533188c370436646530bf825e8a99a07cc89 100644 (file)
@@ -24,6 +24,7 @@ except ImportError:  # pragma: no cover
     ssl = None
 
 from . import base_events
+from . import compat
 from . import events
 from . import futures
 from . import selectors
@@ -421,6 +422,16 @@ class TestCase(unittest.TestCase):
         # 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():
index bedfe16c15c9f5a38e9b129ec08890a3463eb7ef..072fe2f93e7f11d240f3368f5de5a27e798dc00c 100644 (file)
@@ -782,9 +782,10 @@ class BaseEventLoopTests(test_utils.TestCase):
         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