core/tools: rename run_command_batch to run_argv_batch (steps/argv keys)

This commit is contained in:
2026-08-04 21:40:25 +08:00
parent d698fbf06f
commit df8f6bf959
7 changed files with 68 additions and 68 deletions
+20 -20
View File
@@ -10,7 +10,7 @@ from plyngent.tools.process import (
open_pty,
read_pty,
run_argv,
run_command_batch,
run_argv_batch,
write_pty,
write_pty_keys,
)
@@ -78,13 +78,13 @@ async def test_open_pty_string_command_error(workspace: object) -> None:
assert "only accepts an array" in out
async def test_run_command_batch_serial(workspace: object) -> None:
async def test_run_argv_batch_serial(workspace: object) -> None:
del workspace
out = await call_async(
run_command_batch,
run_argv_batch,
[
{"command": _py("print('a')")},
{"command": _py("print('b')")},
{"argv": _py("print('a')")},
{"argv": _py("print('b')")},
],
)
assert "steps=2" in out
@@ -95,13 +95,13 @@ async def test_run_command_batch_serial(workspace: object) -> None:
assert "a" in out and "b" in out
async def test_run_command_batch_stop_on_error(workspace: object) -> None:
async def test_run_argv_batch_stop_on_error(workspace: object) -> None:
del workspace
out = await call_async(
run_command_batch,
run_argv_batch,
[
{"command": _py("import sys; sys.exit(2)")},
{"command": _py("print('should-not-run')")},
{"argv": _py("import sys; sys.exit(2)")},
{"argv": _py("print('should-not-run')")},
],
stop_on_error=True,
)
@@ -110,17 +110,17 @@ async def test_run_command_batch_stop_on_error(workspace: object) -> None:
assert "should-not-run" not in out
async def test_run_command_batch_pipe_out(workspace: object) -> None:
async def test_run_argv_batch_pipe_out(workspace: object) -> None:
del workspace
out = await call_async(
run_command_batch,
run_argv_batch,
[
{
"command": _py("print('piped-payload', end='')"),
"argv": _py("print('piped-payload', end='')"),
"pipe_out": True,
},
{
"command": _py("import sys; print(sys.stdin.read())"),
"argv": _py("import sys; print(sys.stdin.read())"),
},
],
)
@@ -129,27 +129,27 @@ async def test_run_command_batch_pipe_out(workspace: object) -> None:
assert "pipe_out=true" in out
async def test_run_command_batch_last_pipe_out_error(workspace: object) -> None:
async def test_run_argv_batch_last_pipe_out_error(workspace: object) -> None:
del workspace
out = await call_async(
run_command_batch,
[{"command": _py("print(1)"), "pipe_out": True}],
run_argv_batch,
[{"argv": _py("print(1)"), "pipe_out": True}],
)
assert "error:" in out
assert "pipe_out" in out
async def test_run_command_batch_mix_stderr(workspace: object) -> None:
async def test_run_argv_batch_mix_stderr(workspace: object) -> None:
del workspace
out = await call_async(
run_command_batch,
run_argv_batch,
[
{
"command": _py("import sys; sys.stdout.write('out'); sys.stderr.write('err')"),
"argv": _py("import sys; sys.stdout.write('out'); sys.stderr.write('err')"),
"mix_stderr": True,
"pipe_out": True,
},
{"command": _py("import sys; print(repr(sys.stdin.read()))")},
{"argv": _py("import sys; print(repr(sys.stdin.read()))")},
],
)
assert "ran=2" in out