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
(cherry picked from commit
f03a8f8d5001963ad5b5b28dbd95497e9cc15596)
Co-authored-by: Kyle Stanley <aeros167@gmail.com>
main, = interpreters.list_all()
interp = interpreters.create()
with _running(interp):
- with self.assertRaises(RuntimeError):
+ self.assertTrue(interpreters.is_running(interp),
+ msg=f"Interp {interp} should be running before destruction.")
+
+ with self.assertRaises(RuntimeError,
+ msg=f"Should not be able to destroy interp {interp} while it's still running."):
interpreters.destroy(interp)
self.assertTrue(interpreters.is_running(interp))