]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-152391: Improve `test_interpreters.test_stress` test (GH-152396) (#152430)
authorsobolevn <mail@sobolevn.me>
Sat, 27 Jun 2026 15:48:38 +0000 (18:48 +0300)
committerGitHub <noreply@github.com>
Sat, 27 Jun 2026 15:48:38 +0000 (15:48 +0000)
(cherry picked from commit 219f7a9453a2a89266f6e65d75df1606b4816043)

Lib/test/test_interpreters/test_stress.py

index e3060cbd8bccd44e9df732abe17f9e3ad2ef86d8..bf646035cb30a2c56635636cc0e28081dc15a235 100644 (file)
@@ -25,6 +25,7 @@ class StressTests(TestBase):
         del alive
         support.gc_collect()
 
+    @threading_helper.requires_working_threading()
     @support.bigmemtest(size=200, memuse=32*2**20, dry_run=False)
     def test_create_many_threaded(self, size):
         alive = []
@@ -79,9 +80,12 @@ class StressTests(TestBase):
     def test_create_interpreter_no_memory(self):
         import _testcapi
 
-        with self.assertRaises(InterpreterError):
-            _testcapi.set_nomemory(0, 1)
-            _interpreters.create()
+        try:
+            with self.assertRaises(InterpreterError):
+                _testcapi.set_nomemory(0, 1)
+                _interpreters.create()
+        finally:
+            _testcapi.remove_mem_hooks()
 
 
 if __name__ == '__main__':