File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 3
3
import os .path
4
4
import shutil
5
5
import tempfile
6
- from textwrap import dedent
6
+ from textwrap import dedent , indent
7
7
import threading
8
8
import unittest
9
9
14
14
15
15
16
16
SCRIPT_THREADED_INTERP = """\
17
+ from textwrap import dedent
17
18
import threading
18
19
import _interpreters
19
20
def f():
20
- _interpreters.run_string(id, {!r})
21
+ _interpreters.run_string(id, dedent('''
22
+ {}
23
+ '''))
21
24
22
25
t = threading.Thread(target=f)
23
26
t.start()
@@ -48,11 +51,12 @@ def tearDown(self):
48
51
shutil .rmtree (self .dirname )
49
52
50
53
def test_still_running_at_exit (self ):
51
- script = SCRIPT_THREADED_INTERP . format ("""if True:
54
+ subscript = dedent ("""
52
55
import time
53
56
# Give plenty of time for the main interpreter to finish.
54
57
time.sleep(1_000_000)
55
58
""" )
59
+ script = SCRIPT_THREADED_INTERP .format (indent (subscript , ' ' ))
56
60
filename = script_helper .make_script (self .dirname , 'interp' , script )
57
61
with script_helper .spawn_python (filename ) as proc :
58
62
retcode = proc .wait ()
You can’t perform that action at this time.
0 commit comments