Files
aditya d9e51d98f8 fix(tui,cli,tests): harden persona/input modes and stabilize parallel test execution
- Add shell safety controls for REPL/TUI (`looks_dangerous`, confirmation gate, timeout handling, and env-based shell disable guard).
- Secure persona workflows with strict name/path validation, safe import/export resolution, atomic+locked registry writes, and malformed YAML resilience.
- Unify persona models and wiring by reusing canonical TUI schema/registry, adding DI providers, and lazy-loading TUI exports to avoid circular imports.
- Improve reference discovery with ignored-directory filtering, symlink-safe walking, and TTL caching for CLI/TUI reference catalogs.
- Expand Behave/Robot coverage for safety/error paths and parallel-isolation behavior; add shared `features/mocks/fake_repl_input.py` helper.
- Fix parallel-run flakiness via deterministic cleanup/reload patterns and watchdog polling fallback when inotify limits are reached.

ISSUES CLOSED: #695
2026-03-18 10:09:06 +00:00

23 lines
726 B
Python

"""Shared fake input helper for REPL Behave scenarios."""
from __future__ import annotations
class FakeReplInput:
"""Feed predefined lines and then terminate input with EOFError."""
def __init__(self, lines: list[str], *, interrupt_token: str | None = None) -> None:
self._lines = list(lines)
self._index = 0
self._interrupt_token = interrupt_token
def __call__(self, prompt: str = "") -> str:
del prompt
if self._index >= len(self._lines):
raise EOFError
line = self._lines[self._index]
self._index += 1
if self._interrupt_token is not None and line == self._interrupt_token:
raise KeyboardInterrupt
return line