summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2015-11-20 17:57:34 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2015-11-20 17:57:34 (GMT)
commit0f3c9765d4dd5e0b4df608baf8d93cc0e5c4b227 (patch)
treec588a7ea1770a0e0ca9d835b70a8324769b189ca /Lib
parenta211a7a0e7f5795e4049bd089a8c663189abe3f1 (diff)
downloadcpython-0f3c9765d4dd5e0b4df608baf8d93cc0e5c4b227.zip
cpython-0f3c9765d4dd5e0b4df608baf8d93cc0e5c4b227.tar.gz
cpython-0f3c9765d4dd5e0b4df608baf8d93cc0e5c4b227.tar.bz2
asyncio: Fix with github
See https://github.com/python/asyncio/pull/295 for details
Diffstat (limited to 'Lib')
-rw-r--r--Lib/asyncio/test_utils.py11
-rw-r--r--Lib/test/test_asyncio/test_base_events.py7
2 files changed, 15 insertions, 3 deletions
diff --git a/Lib/asyncio/test_utils.py b/Lib/asyncio/test_utils.py
index e06ac06..8170533 100644
--- a/Lib/asyncio/test_utils.py
+++ b/Lib/asyncio/test_utils.py
@@ -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():
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
index bedfe16..072fe2f 100644
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
@@ -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