summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-06-02 23:35:37 (GMT)
committerGitHub <noreply@github.com>2019-06-02 23:35:37 (GMT)
commit3cf7ea1272fbc921a89acdbe40ca152813028cb5 (patch)
tree08288a13b4dfef0389cb0fe3fd9ddb9b24c0ab55 /Lib
parent7f4ae1b2cc60cb69938e7c88793b9e9a2dd36d93 (diff)
downloadcpython-3cf7ea1272fbc921a89acdbe40ca152813028cb5.zip
cpython-3cf7ea1272fbc921a89acdbe40ca152813028cb5.tar.gz
cpython-3cf7ea1272fbc921a89acdbe40ca152813028cb5.tar.bz2
bpo-37100: Fix test_coroutines with -Werror (GH-13756)
test_coroutines: test_unawaited_warning_when_module_broken() now uses support.check_warnings() to catch expected RuntimeWarning.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_coroutines.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py
index 0e7eb3a..b406b1c 100644
--- a/Lib/test/test_coroutines.py
+++ b/Lib/test/test_coroutines.py
@@ -2250,7 +2250,8 @@ class OriginTrackingTest(unittest.TestCase):
try:
warnings._warn_unawaited_coroutine = lambda coro: 1/0
with support.catch_unraisable_exception() as cm, \
- support.captured_stderr() as stream:
+ support.check_warnings((r'coroutine .* was never awaited',
+ RuntimeWarning)):
# only store repr() to avoid keeping the coroutine alive
coro = corofn()
coro_repr = repr(coro)
@@ -2261,13 +2262,12 @@ class OriginTrackingTest(unittest.TestCase):
self.assertEqual(repr(cm.unraisable.object), coro_repr)
self.assertEqual(cm.unraisable.exc_type, ZeroDivisionError)
- self.assertIn("was never awaited", stream.getvalue())
del warnings._warn_unawaited_coroutine
- with support.captured_stderr() as stream:
+ with support.check_warnings((r'coroutine .* was never awaited',
+ RuntimeWarning)):
corofn()
support.gc_collect()
- self.assertIn("was never awaited", stream.getvalue())
finally:
warnings._warn_unawaited_coroutine = orig_wuc