Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean up a test.
  • Loading branch information
ericsnowcurrently committed May 23, 2017
commit 80ab76a6086982339f09e008fcaa1c8993f701d0
10 changes: 7 additions & 3 deletions Lib/test/test__interpreters.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os.path
import shutil
import tempfile
from textwrap import dedent
from textwrap import dedent, indent
import threading
import unittest

Expand All @@ -14,10 +14,13 @@


SCRIPT_THREADED_INTERP = """\
from textwrap import dedent
import threading
import _interpreters
def f():
_interpreters.run_string(id, {!r})
_interpreters.run_string(id, dedent('''
{}
'''))

t = threading.Thread(target=f)
t.start()
Expand Down Expand Up @@ -48,11 +51,12 @@ def tearDown(self):
shutil.rmtree(self.dirname)

def test_still_running_at_exit(self):
script = SCRIPT_THREADED_INTERP.format("""if True:
subscript = dedent("""
import time
# Give plenty of time for the main interpreter to finish.
time.sleep(1_000_000)
""")
script = SCRIPT_THREADED_INTERP.format(indent(subscript, ' '))
filename = script_helper.make_script(self.dirname, 'interp', script)
with script_helper.spawn_python(filename) as proc:
retcode = proc.wait()
Expand Down