Skip to content

Commit 3206fc7

Browse files
[3.15] gh-152391: Improve test_interpreters.test_stress test (GH-152396) (#152427)
gh-152391: Improve `test_interpreters.test_stress` test (GH-152396) (cherry picked from commit 219f7a9) Co-authored-by: sobolevn <mail@sobolevn.me>
1 parent bfb01d8 commit 3206fc7

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

Lib/test/test_interpreters/test_stress.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def test_create_many_sequential(self):
2525
del alive
2626
support.gc_collect()
2727

28+
@threading_helper.requires_working_threading()
2829
@support.bigmemtest(size=200, memuse=32*2**20, dry_run=False)
2930
def test_create_many_threaded(self, size):
3031
alive = []
@@ -80,9 +81,12 @@ def test_create_interpreter_no_memory(self):
8081
import _testcapi
8182

8283
assertion = self.assertRaises(InterpreterError)
83-
_testcapi.set_nomemory(0, 1)
84-
with assertion:
85-
_interpreters.create()
84+
try:
85+
_testcapi.set_nomemory(0, 1)
86+
with assertion:
87+
_interpreters.create()
88+
finally:
89+
_testcapi.remove_mem_hooks()
8690

8791

8892
if __name__ == '__main__':

0 commit comments

Comments
 (0)