Files
EvoScientist/tests/test_cli_resume_flag.py
Xi Zhang aa3dd00409 feat: add support for session resumption with --resume flag and enhan… (#170)
* feat: add support for session resumption with --resume flag and enhance thread ID resolution

* refactor(tests): streamline help output testing for --resume flag

* feat: enhance session resume functionality with improved thread ID resolution and SQL wildcard handling

* feat: improve error handling for resume hint retrieval in interactive modes

* refactor: streamline logging for print_resume_hint failure in interactive mode

* feat: implement deferred scrolling for Markdown-heavy content in interactive mode
2026-04-21 21:26:40 +01:00

36 lines
914 B
Python

"""Tests for the ``--resume`` CLI flag (alias of ``--thread-id``)."""
from __future__ import annotations
import re
from typer.testing import CliRunner
from EvoScientist.cli._app import app
runner = CliRunner()
_ANSI_RE = re.compile(r"\x1b\[[0-9;]*m")
def _plain_help() -> str:
"""Render ``--help`` and strip ANSI escapes.
Rich inserts per-character color codes (e.g. ``\\x1b[36m-\\x1b[0m\\x1b[36m-name``),
which break literal substring lookups like ``"--resume" in stdout``.
"""
result = runner.invoke(app, ["--help"])
assert result.exit_code == 0
return _ANSI_RE.sub("", result.stdout)
def test_resume_flag_listed_in_help():
plain = _plain_help()
assert "--resume" in plain
assert "--thread-id" in plain
def test_thread_id_flag_still_works():
"""Backwards compatibility: --thread-id should remain a valid flag."""
assert "--thread-id" in _plain_help()