Skip to content

Commit d967418

Browse files
Simplify the fix.
1 parent 4e6cb96 commit d967418

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Lib/test/test_unittest/test_case.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,10 @@ class Foo(unittest.TestCase):
346346
async def test1(self):
347347
return 1
348348

349-
with warnings.catch_warnings():
350-
# Ignore RuntimeWarning: coroutine '...' was never awaited
351-
warnings.simplefilter("ignore", RuntimeWarning)
352-
with self.assertWarns((DeprecationWarning, )) as w:
353-
Foo('test1').run()
349+
with self.assertWarns(DeprecationWarning) as w:
350+
warnings.filterwarnings('ignore',
351+
'coroutine .* was never awaited', RuntimeWarning)
352+
Foo('test1').run()
354353
support.gc_collect()
355354
self.assertIn('It is deprecated to return a value that is not None', str(w.warning))
356355
self.assertIn('test1', str(w.warning))

0 commit comments

Comments
 (0)