8000 Clean up a test. · python/cpython@7c4dae2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7c4dae2

Browse files
Clean up a test.
1 parent 8cd338d commit 7c4dae2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Lib/test/test__interpreters.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os.path
44
import shutil
55
import tempfile
6-
from textwrap import dedent
6+
from textwrap import dedent, indent
77
import threading
88
import unittest
99

@@ -14,10 +14,13 @@
1414

1515

1616
SCRIPT_THREADED_INTERP = """\
17+
from textwrap import dedent
1718
import threading
1819
import _interpreters
1920
def f():
20-
_interpreters.run_string(id, {!r})
21+
_interpreters.run_string(id, dedent('''
22+
{}
23+
'''))
2124
2225
t = threading.Thread(target=f)
2326
t.start()
@@ -48,11 +51,12 @@ def tearDown(self):
4851
shutil.rmtree(self.dirname)
4952

5053
def test_still_running_at_exit(self):
51-
script = SCRIPT_THREADED_INTERP.format("""if True:
54+
subscript = dedent("""
5255
import time
5356
# Give plenty of time for the main interpreter to finish.
5457
time.sleep(1_000_000)
5558
""")
59+
script = SCRIPT_THREADED_INTERP.format(indent(subscript, ' '))
5660
filename = script_helper.make_script(self.dirname, 'interp', script)
5761
with script_helper.spawn_python(filename) as proc:
5862
retcode = proc.wait()

0 commit comments

Comments
 (0)
0