From c4ee5e1a2e35e9516f90c6802c838bf3b53ab76c Mon Sep 17 00:00:00 2001 From: Mohamed Ashraf Date: Tue, 28 Apr 2026 16:39:00 +0000 Subject: [PATCH] fix: decode help-banner test subprocess output as UTF-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- tests/test_help_banner.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/test_help_banner.py b/tests/test_help_banner.py index c5d801b23..27d749790 100644 --- a/tests/test_help_banner.py +++ b/tests/test_help_banner.py @@ -4,7 +4,10 @@ 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 + [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 @@ -12,7 +15,10 @@ def test_help_displays_logo() -> None: 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 + [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