Files
hermes-agent/tests/test_run_tests_shell.py
ethernet 7f6d63bcbb fix(termux): classify bionic from its interpreter and run the Linux tests
The POSIX runner had a blank line after exec env, so it printed the environment and never ran pytest. Keep the command attached and prove failure propagation. The actual payload records ANDROID_API_LEVEL in sysconfig; use that instead of looking for text in a guessed libc file. Rebuild unproven runtime-library extracts from verified archives.
2026-09-06 14:12:12 -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[1]
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