Skip to content

Commit aad39d5

Browse files
committed
fix(tests): strip ANSI codes before asserting in test_demo_help
Rich renders --help with ANSI colour escapes on CI (Linux), breaking plain-string substring checks. Strip escape sequences first.
1 parent 0b5dfe2 commit aad39d5

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/test_cli.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Tests for the Typer CLI entry point."""
22

3+
import re
34
from pathlib import Path
45
from unittest.mock import ANY, MagicMock, patch
56

@@ -653,8 +654,9 @@ def test_replay_total_duration(tmp_path: Path) -> None:
653654
def test_demo_help() -> None:
654655
result = runner.invoke(app, ["demo", "--help"])
655656
assert result.exit_code == 0
656-
assert "--output" in result.output
657-
assert "--github-url" in result.output
657+
plain = re.sub(r"\x1b\[[0-9;]*m", "", result.output)
658+
assert "--output" in plain
659+
assert "--github-url" in plain
658660

659661

660662
def test_demo_runs(tmp_path: Path) -> None:

0 commit comments

Comments
 (0)