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

Merged
merged 2 commits into from
Jan 12, 2025

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.

@serhiy-storchaka serhiy-storchaka merged commit cb72feb into python:main Jan 12, 2025
38 checks passed
@miss-islington-app
Copy link

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@miss-islington-app
Copy link

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker cb72feb8a30edb448bc8dc31330ed7420279d7c2 3.13

@miss-islington-app
Copy link

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker cb72feb8a30edb448bc8dc31330ed7420279d7c2 3.12

@serhiy-storchaka serhiy-storchaka deleted the test_unittest-warning branch January 12, 2025 10:55
@serhiy-storchaka serhiy-storchaka removed needs backport to 3.12 bug and security fixes needs backport to 3.13 bugs and security fixes labels Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants