Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-128729: Fix RuntimeWarning in test_unittest #128730

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Jan 11, 2025

@serhiy-storchaka serhiy-storchaka added needs backport to 3.12 bug and security fixes needs backport to 3.13 bugs and security fixes labels Jan 11, 2025
@bedevere-app bedevere-app bot added the tests Tests in the Lib/test dir label Jan 11, 2025
@serhiy-storchaka serhiy-storchaka changed the title gh-128729: Fix ResourceWarning in test_unittest gh-128729: Fix RuntimeWarning in test_unittest Jan 11, 2025
@@ -346,8 +346,12 @@ class Foo(unittest.TestCase):
async def test1(self):
return 1

with self.assertWarns(DeprecationWarning) as w:
Foo('test1').run()
with warnings.catch_warnings():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think neater to use check_warnings: f0490ab (#128726)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RuntimeWarning is less important for this test.

I think that check_warnings is too heavy for this. It requires to repeat the DeprecationWarning message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs backport to 3.12 bug and security fixes needs backport to 3.13 bugs and security fixes skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants