Files
hermes-agent/tests/scripts/test_run_tests_shell.py
ethernet cb7c688171 test: mirror the source tree for 27 misfiled root tests; one PM home fixture
Root-level tests/ is for root-level modules; 19 files testing scripts/, 3 testing
pm/ and 5 testing hermes_cli/ move to the mirrored directory (workflow file lists
and cross-imports updated; path arithmetic bumped one level).

tests/pm gains a conftest with the isolated_machine_home fixture that seven
modules had copy-pasted verbatim.
2026-09-18 20:13:26 -04:00

30 lines
1.1 KiB
Python

"""The canonical shell must run tests and propagate a failing test's status."""
from pathlib import Path
import os
import subprocess
import sys
import pytest
@pytest.mark.platforms("posix")
def test_shell_runner_executes_tests_and_propagates_failure(tmp_path):
case = tmp_path / "test_runner_canary.py"
marker = tmp_path / "executed"
case.write_text(
"from pathlib import Path\n"
"def test_canary():\n"
f" Path({str(marker)!r}).write_text('executed')\n"
" assert False, 'runner failure propagation canary'\n",
encoding="utf-8",
)
root = Path(__file__).resolve().parents[2]
result = subprocess.run(
["bash", str(root / "scripts/run_tests.sh"), "-j", "1", str(case)],
cwd=tmp_path, capture_output=True, text=True, timeout=180,
env={**os.environ, "HERMES_PYTHON": sys.executable, "HERMES_TEST_FILE_RETRIES": "0"},
)
assert marker.read_text(encoding="utf-8") == "executed", result.stdout + result.stderr
assert result.returncode != 0, result.stdout + result.stderr
assert "runner failure propagation canary" in result.stdout + result.stderr