Commit 0f3c9765 authored by Yury Selivanov's avatar Yury Selivanov

asyncio: Fix with github

See https://github.com/python/asyncio/pull/295 for details
parent a211a7a0
...@@ -24,6 +24,7 @@ except ImportError: # pragma: no cover ...@@ -24,6 +24,7 @@ except ImportError: # pragma: no cover
ssl = None ssl = None
from . import base_events from . import base_events
from . import compat
from . import events from . import events
from . import futures from . import futures
from . import selectors from . import selectors
...@@ -421,6 +422,16 @@ class TestCase(unittest.TestCase): ...@@ -421,6 +422,16 @@ class TestCase(unittest.TestCase):
# in an except block of a generator # in an except block of a generator
self.assertEqual(sys.exc_info(), (None, None, None)) 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 @contextlib.contextmanager
def disable_logger(): def disable_logger():
......
...@@ -782,6 +782,7 @@ class BaseEventLoopTests(test_utils.TestCase): ...@@ -782,6 +782,7 @@ class BaseEventLoopTests(test_utils.TestCase):
self.loop._selector.select.return_value = (event_sentinel,) self.loop._selector.select.return_value = (event_sentinel,)
for i in range(1, 3): for i in range(1, 3):
with self.subTest('Loop %d/2' % i):
self.loop.call_soon(self.loop.stop) self.loop.call_soon(self.loop.stop)
self.loop.run_forever() self.loop.run_forever()
self.assertEqual(callcount, 1) self.assertEqual(callcount, 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment