diff --git a/src/gpu_rent/access_card.py b/src/gpu_rent/access_card.py index aed970a..bc93ccb 100644 --- a/src/gpu_rent/access_card.py +++ b/src/gpu_rent/access_card.py @@ -209,7 +209,11 @@ def print_access_card( log("hold: gpu-rent hold | stop: gpu-rent stop") log("") return - Console(highlight=False, legacy_windows=False).print(panel) + from gpu_rent.term import console as default_console + + default_console.print() + default_console.print(panel) + default_console.print() def print_mcp_snippet(cfg: Config, log: Log) -> None: diff --git a/tests/test_pools.py b/tests/test_pools.py index 1fa7761..e061050 100644 --- a/tests/test_pools.py +++ b/tests/test_pools.py @@ -19,4 +19,4 @@ def test_format_pool_scan_recommends_first_hit(): text = "\n".join(format_pool_scan(offers, ("4090-24", "4090-48"))) assert "ru-6" in text and "multizone" in text assert "типы:" in text - assert "рекомендация: OS_REGION_NAME=ru-6" in text + assert "рекомендация:" in text and "OS_REGION_NAME=ru-6" in text diff --git a/tests/test_prompts.py b/tests/test_prompts.py index b00c908..c262d56 100644 --- a/tests/test_prompts.py +++ b/tests/test_prompts.py @@ -28,5 +28,5 @@ def test_prompt_menu_prints_and_picks(): show=shown.append, ) assert key == "recommended" - assert any("1. rec" in line for line in shown) + assert any("rec" in line for line in shown) assert any("←" in line for line in shown) diff --git a/tests/test_term.py b/tests/test_term.py new file mode 100644 index 0000000..9c776eb --- /dev/null +++ b/tests/test_term.py @@ -0,0 +1,28 @@ +from gpu_rent.term import paint + + +def test_paint_warn_bang(): + out = paint("! диск data тарифицируется 24/7") + assert "[yellow]" in out + + +def test_paint_error(): + out = paint("idle-killer fail: timeout") + assert "[red]" in out + + +def test_paint_ok(): + out = paint("doctor ok (16 проверок)") + assert "[green]" in out + + +def test_paint_passthrough_markup(): + raw = "[green]рекомендация:[/green] ru-6" + assert paint(raw) == raw + + +def test_paint_passthrough_only_our_markup(): + raw = "[yellow]! риск[/yellow]" + assert paint(raw) == raw + # Letter-tags look like Rich markup → left for caller who built them. + assert "[bold]" in paint("note [bold]x[/bold] end")