aa3dd00409
* 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
36 lines
914 B
Python
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()
|