Skip to content

Commit d54a98e

Browse files
committed
Add failing test
1 parent 80a0d98 commit d54a98e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Lib/test/test_repl.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def make_repl(env):
218218
with os_helper.temp_dir() as tmpdir:
219219
script = os.path.join(tmpdir, "pythonstartup.py")
220220
with open(script, "w") as f:
221-
f.write("print('from pythonstartup')" + os.linesep)
221+
f.write("print('from pythonstartup')\n")
222222

223223
env = os.environ.copy()
224224
env['PYTHONSTARTUP'] = script
@@ -295,6 +295,19 @@ def bar(x):
295295
expected = "(30, None, [\'def foo(x):\\n\', \' return x + 1\\n\', \'\\n\'], \'<stdin>\')"
296296
self.assertIn(expected, output, expected)
297297

298+
def test_asyncio_repl_respects_isolated_mode(self):
299+
with os_helper.temp_dir() as tmpdir:
300+
script = os.path.join(tmpdir, "pythonstartup.py")
301+
with open(script, "w") as f:
302+
f.write("print('should not print')\n")
303+
env = os.environ.copy()
304+
env["PYTHON_HISTORY"] = os.path.join(tmpdir, ".asyncio_history")
305+
env["PYTHONSTARTUP"] = script
306+
p = spawn_asyncio_repl(isolated=True, env=env)
307+
output = kill_python(p)
308+
self.assertEqual(p.returncode, 0)
309+
self.assertNotIn("should not print", output)
310+
298311
def test_asyncio_repl_reaches_python_startup_script(self):
299312
with os_helper.temp_dir() as tmpdir:
300313
script = os.path.join(tmpdir, "pythonstartup.py")

0 commit comments

Comments
 (0)