diff options
author | Hai Shi <shihai1992@gmail.com> | 2020-08-03 16:41:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-03 16:41:24 (GMT) |
commit | a7f5d93bb6906d0f999248b47295d3a59b130f4d (patch) | |
tree | a0dc5043ecc7a4250902f8d14c802382b1c94b8a /Lib/test/test_coroutines.py | |
parent | 488512bf4953d856fcb049a05060a450af52fcdc (diff) | |
download | cpython-a7f5d93bb6906d0f999248b47295d3a59b130f4d.zip cpython-a7f5d93bb6906d0f999248b47295d3a59b130f4d.tar.gz cpython-a7f5d93bb6906d0f999248b47295d3a59b130f4d.tar.bz2 |
bpo-40275: Use new test.support helper submodules in tests (GH-21449)
Diffstat (limited to 'Lib/test/test_coroutines.py')
-rw-r--r-- | Lib/test/test_coroutines.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py index 8d1e069..145adb6 100644 --- a/Lib/test/test_coroutines.py +++ b/Lib/test/test_coroutines.py @@ -7,6 +7,8 @@ import types import unittest import warnings from test import support +from test.support import import_helper +from test.support import warnings_helper from test.support.script_helper import assert_python_ok @@ -2117,7 +2119,7 @@ class CoroAsyncIOCompatTest(unittest.TestCase): def test_asyncio_1(self): # asyncio cannot be imported when Python is compiled without thread # support - asyncio = support.import_module('asyncio') + asyncio = import_helper.import_module('asyncio') class MyException(Exception): pass @@ -2258,8 +2260,9 @@ class OriginTrackingTest(unittest.TestCase): try: warnings._warn_unawaited_coroutine = lambda coro: 1/0 with support.catch_unraisable_exception() as cm, \ - support.check_warnings((r'coroutine .* was never awaited', - RuntimeWarning)): + warnings_helper.check_warnings( + (r'coroutine .* was never awaited', + RuntimeWarning)): # only store repr() to avoid keeping the coroutine alive coro = corofn() coro_repr = repr(coro) @@ -2272,8 +2275,8 @@ class OriginTrackingTest(unittest.TestCase): self.assertEqual(cm.unraisable.exc_type, ZeroDivisionError) del warnings._warn_unawaited_coroutine - with support.check_warnings((r'coroutine .* was never awaited', - RuntimeWarning)): + with warnings_helper.check_warnings( + (r'coroutine .* was never awaited', RuntimeWarning)): corofn() support.gc_collect() |