Skip to content

Commit f03a8f8

Browse files
authored
bpo-37224: Improve test__xxsubinterpreters.DestroyTests (GH-18058)
Adds an additional assertion check based on a race condition for `test__xxsubinterpreters.DestroyTests.test_still_running` discovered in the bpo issue. https://bugs.python.org/issue37224
1 parent 58a4054 commit f03a8f8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Lib/test/test__xxsubinterpreters.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,11 @@ def test_still_running(self):
759759
main, = interpreters.list_all()
760760
interp = interpreters.create()
761761
with _running(interp):
762-
with self.assertRaises(RuntimeError):
762+
self.assertTrue(interpreters.is_running(interp),
763+
msg=f"Interp {interp} should be running before destruction.")
764+
765+
with self.assertRaises(RuntimeError,
766+
msg=f"Should not be able to destroy interp {interp} while it's still running."):
763767
interpreters.destroy(interp)
764768
self.assertTrue(interpreters.is_running(interp))
765769

0 commit comments

Comments
 (0)