Skip to content

Commit

Permalink
Simplify the fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiy-storchaka committed Jan 11, 2025
1 parent 4e6cb96 commit d967418
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Lib/test/test_unittest/test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,10 @@ class Foo(unittest.TestCase):
async def test1(self):
return 1

with warnings.catch_warnings():
# Ignore RuntimeWarning: coroutine '...' was never awaited
warnings.simplefilter("ignore", RuntimeWarning)
with self.assertWarns((DeprecationWarning, )) as w:
Foo('test1').run()
with self.assertWarns(DeprecationWarning) as w:
warnings.filterwarnings('ignore',
'coroutine .* was never awaited', RuntimeWarning)
Foo('test1').run()
support.gc_collect()
self.assertIn('It is deprecated to return a value that is not None', str(w.warning))
self.assertIn('test1', str(w.warning))
Expand Down

0 comments on commit d967418

Please sign in to comment.