codeflash/tests/test_help_banner.py
Mohamed Ashraf 2908f76e64 fix: decode help-banner test subprocess output as UTF-8
Rich renders the banner panel with box-drawing characters (╭, ╮, │, etc.)
that cp1252 cannot decode. On Windows, subprocess.run(..., text=True) uses
cp1252 by default, so decoding the child stdout raises UnicodeDecodeError
and subprocess sets result.stdout to None — breaking the assertion with a
misleading "argument of type 'NoneType' is not iterable".

Pass encoding="utf-8" explicitly so the test passes on every platform.
2026-04-28 16:42:10 +00:00

24 lines
660 B
Python

import subprocess
import sys
def test_help_displays_logo() -> None:
result = subprocess.run(
[sys.executable, "-c", "from codeflash.main import main; main()", "--help"],
capture_output=True,
text=True,
encoding="utf-8",
)
assert result.returncode == 0
assert "codeflash.ai" in result.stdout
def test_help_short_flag_displays_logo() -> None:
result = subprocess.run(
[sys.executable, "-c", "from codeflash.main import main; main()", "-h"],
capture_output=True,
text=True,
encoding="utf-8",
)
assert result.returncode == 0
assert "codeflash.ai" in result.stdout