Skip to content

Commit 0eefb8d

Browse files
committed
Fix flakey test_warnings under free threading
Ensure we setup a context in setUp before resetting warnings
1 parent 8a4ee5c commit 0eefb8d

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Lib/test/test_warnings/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,6 +1720,7 @@ class AsyncTests(BaseTest):
17201720

17211721
def setUp(self):
17221722
super().setUp()
1723+
self.enterContext(self.module.catch_warnings())
17231724
self.module.resetwarnings()
17241725

17251726
@unittest.skipIf(not sys.flags.context_aware_warnings,
@@ -1816,6 +1817,7 @@ class ThreadTests(BaseTest):
18161817

18171818
def setUp(self):
18181819
super().setUp()
1820+
self.enterContext(self.module.catch_warnings())
18191821
self.module.resetwarnings()
18201822

18211823
@unittest.skipIf(not ENABLE_THREAD_TESTS,

0 commit comments

Comments
 (0)