Skip to content

Commit 9b7ea66

Browse files
committed
Fix sibling test
`os.linesep` was incorrect. The writer already normalizes line ending at the lower level. +We can reuse `spawn_asyncio_repl`.
1 parent d54a98e commit 9b7ea66

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

Lib/test/test_repl.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -312,19 +312,14 @@ def test_asyncio_repl_reaches_python_startup_script(self):
312312
with os_helper.temp_dir() as tmpdir:
313313
script = os.path.join(tmpdir, "pythonstartup.py")
314314
with open(script, "w") as f:
315-
f.write("print('pythonstartup done!')" + os.linesep)
316-
f.write("exit(0)" + os.linesep)
317-
315+
f.write("print('pythonstartup done!')\n")
318316
env = os.environ.copy()
319317
env["PYTHON_HISTORY"] = os.path.join(tmpdir, ".asyncio_history")
320318
env["PYTHONSTARTUP"] = script
321-
subprocess.check_call(
322-
[sys.executable, "-m", "asyncio"],
323-
stdout=subprocess.PIPE,
324-
stderr=subprocess.PIPE,
325-
env=env,
326-
timeout=SHORT_TIMEOUT,
327-
)
319+
p = spawn_asyncio_repl(env=env)
320+
output = kill_python(p)
321+
self.assertEqual(p.returncode, 0)
322+
self.assertIn("pythonstartup done!", output)
328323

329324
@unittest.skipUnless(pty, "requires pty")
330325
def test_asyncio_repl_is_ok(self):

0 commit comments

Comments
 (0)