File tree Expand file tree Collapse file tree 1 file changed +3
-18
lines changed
Expand file tree Collapse file tree 1 file changed +3
-18
lines changed Original file line number Diff line number Diff line change 66import gc
77import os
88import types
9- import tempfile
10- import subprocess
119
1210import _opcode
1311
1412from test .support import (script_helper , requires_specialization ,
1513 import_helper , Py_GIL_DISABLED , requires_jit_enabled ,
16- reset_code , requires_subprocess )
14+ reset_code )
1715
1816_testinternalcapi = import_helper .import_module ("_testinternalcapi" )
1917
@@ -2662,9 +2660,8 @@ def f():
26622660
26632661 f ()
26642662
2665- @requires_subprocess ()
26662663 def test_interpreter_finalization_with_generator_alive (self ):
2667- code = textwrap .dedent ("""
2664+ script_helper . assert_python_ok ( "-c" , textwrap .dedent ("""
26682665 import sys
26692666 def simple_for():
26702667 for x in (1, 2):
@@ -2680,20 +2677,8 @@ def gen():
26802677 simple_for()
26812678 g = gen()
26822679 next(g)
2683- print("finished", end='')
2684- """ )
2680+ """ ))
26852681
2686- tmp = tempfile .NamedTemporaryFile (delete = False , suffix = '.py' )
2687- tmp .write (code .encode ('utf-8' ))
2688- tmp .close ()
2689- try :
2690- p = subprocess .Popen ([sys .executable , tmp .name ], stdout = subprocess .PIPE , stderr = subprocess .STDOUT )
2691- p .wait ()
2692- out = p .stdout .read ()
2693- finally :
2694- os .remove (tmp .name )
2695- p .stdout .close ()
2696- self .assertEqual (b"finished" , out )
26972682
26982683def global_identity (x ):
26992684 return x
You can’t perform that action at this time.
0 commit comments