diff --git a/tests/test_hands_shell.py b/tests/test_hands_shell.py index 27e7ecd..4cf8e90 100644 --- a/tests/test_hands_shell.py +++ b/tests/test_hands_shell.py @@ -10,6 +10,7 @@ Covers: """ import asyncio +import sys import pytest @@ -91,8 +92,10 @@ async def test_run_python_expression(): """Running a python one-liner should succeed.""" from infrastructure.hands.shell import ShellHand - hand = ShellHand() - result = await hand.run("python -c 'print(2 + 2)'") + # Allow both 'python' and 'python3' (sys.executable basename) + allowed = ("python", "python3") + hand = ShellHand(allowed_prefixes=allowed) + result = await hand.run(f"{sys.executable} -c 'print(2 + 2)'") assert result.success is True assert "4" in result.stdout @@ -118,8 +121,10 @@ async def test_run_nonzero_exit(): """A command that exits non-zero should return success=False.""" from infrastructure.hands.shell import ShellHand - hand = ShellHand() - result = await hand.run("python -c 'import sys; sys.exit(1)'") + # Allow both 'python' and 'python3' (sys.executable basename) + allowed = ("python", "python3") + hand = ShellHand(allowed_prefixes=allowed) + result = await hand.run(f"{sys.executable} -c 'import sys; sys.exit(1)'") assert result.success is False assert result.exit_code == 1