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
924 B
Python
36 lines
924 B
Python
"""Tests for the session-exit resume hint helper."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import io
|
|
|
|
from rich.console import Console
|
|
|
|
from EvoScientist.cli.resume_hint import print_resume_hint
|
|
|
|
|
|
def _capture(thread_id: str | None) -> str:
|
|
buf = io.StringIO()
|
|
console = Console(file=buf, force_terminal=False, width=120, color_system=None)
|
|
print_resume_hint(thread_id, console=console)
|
|
return buf.getvalue()
|
|
|
|
|
|
def test_prints_goodbye_and_hint_for_thread_id():
|
|
output = _capture("365cf731")
|
|
assert "Goodbye!" in output
|
|
assert "Resume this session with:" in output
|
|
assert "EvoSci --resume 365cf731" in output
|
|
|
|
|
|
def test_none_thread_id_prints_only_goodbye():
|
|
output = _capture(None)
|
|
assert "Goodbye!" in output
|
|
assert "Resume" not in output
|
|
|
|
|
|
def test_empty_thread_id_prints_only_goodbye():
|
|
output = _capture("")
|
|
assert "Goodbye!" in output
|
|
assert "Resume" not in output
|