mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-09 08:21:50 +00:00
test: add pytest guard for subprocess stdin= in TUI-context code
Wraps scripts/check_subprocess_stdin.py as a pytest so CI catches regressions when new subprocess calls are added without stdin=.
This commit is contained in:
parent
bddab61bcb
commit
8bb60ff039
1 changed files with 25 additions and 0 deletions
25
tests/tools/test_subprocess_stdin_guard.py
Normal file
25
tests/tools/test_subprocess_stdin_guard.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
"""Verify that TUI-context subprocess calls specify stdin=.
|
||||
|
||||
This is the pytest wrapper for scripts/check_subprocess_stdin.py.
|
||||
It runs as part of the test suite so CI catches regressions when new
|
||||
subprocess calls are added without stdin=subprocess.DEVNULL.
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
SCRIPT = Path(__file__).resolve().parents[2] / "scripts" / "check_subprocess_stdin.py"
|
||||
|
||||
|
||||
def test_all_tui_subprocess_calls_have_stdin():
|
||||
"""Every subprocess.run/Popen in TUI-context code must set stdin=."""
|
||||
result = subprocess.run(
|
||||
[sys.executable, str(SCRIPT)],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=30,
|
||||
)
|
||||
assert result.returncode == 0, (
|
||||
f"subprocess stdin= check failed:\n{result.stdout}\n{result.stderr}"
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue