gh-128729: Fix RuntimeWarning in test_unittest (GH-128730)

This commit is contained in:
Serhiy Storchaka 2025-01-12 12:22:43 +02:00 committed by GitHub
parent 30268b5d2f
commit cb72feb8a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -347,7 +347,10 @@ class Test_TestCase(unittest.TestCase, TestEquality, TestHashing):
return 1
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))
self.assertEqual(w.filename, __file__)