summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-02-04 15:31:19 (GMT)
committerGitHub <noreply@github.com>2020-02-04 15:31:19 (GMT)
commit9a740b6c7e7a88185d79128b8a1993ac387d5091 (patch)
treefb2b8ca754a1d0e8a672936dcfd70ba502234656 /Lib/test
parenta0389ba84bb2dbee7a59e25163e514059afc166d (diff)
downloadcpython-9a740b6c7e7a88185d79128b8a1993ac387d5091.zip
cpython-9a740b6c7e7a88185d79128b8a1993ac387d5091.tar.gz
cpython-9a740b6c7e7a88185d79128b8a1993ac387d5091.tar.bz2
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 (cherry picked from commit f03a8f8d5001963ad5b5b28dbd95497e9cc15596) Co-authored-by: Kyle Stanley <aeros167@gmail.com>
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test__xxsubinterpreters.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test__xxsubinterpreters.py b/Lib/test/test__xxsubinterpreters.py
index 207b5db..30f8f98 100644
--- a/Lib/test/test__xxsubinterpreters.py
+++ b/Lib/test/test__xxsubinterpreters.py
@@ -759,7 +759,11 @@ class DestroyTests(TestBase):
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))