fix: decode help-banner test subprocess output as UTF-8#2120
Merged
mashraf-222 merged 1 commit intomainfrom Apr 28, 2026
Merged
fix: decode help-banner test subprocess output as UTF-8#2120mashraf-222 merged 1 commit intomainfrom
mashraf-222 merged 1 commit intomainfrom
Conversation
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.
This was referenced Apr 28, 2026
KRRT7
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
tests/test_help_banner.pyhas been failing onunit-tests (windows-latest, 3.13)since PR #2014 introduced it. CI on main is red — see https://github.com/codeflash-ai/codeflash/actions/runs/25056045918 and earlier. The failure isTypeError: argument of type 'NoneType' is not iterableatassert "codeflash.ai" in result.stdout.Root Cause
print_codeflash_banner()renders a RichPanelthat contains box-drawing characters (╭,╮,│,╰, etc.). The subprocess call usessubprocess.run(..., text=True)without an explicitencoding=. On Windows,text=Truedefaults tocp1252, which cannot decode those code points. Python'ssubprocesscatches theUnicodeDecodeErrorinternally and setsresult.stdout = None, which is what surfaces as the confusingNoneTypeerror at the assertion.Fix
Pass
encoding="utf-8"explicitly on bothsubprocess.runcalls — matches the repo's existingcode-style.mdrule that requiresencoding="utf-8"onopen/read_text/write_text.Validation
Tests were already passing on Linux (
ubuntu-latestwith default UTF-8 locale); the change does not regress them. This unblocks therequired checks passedgate on PRs #1947, #1950, #1951, #1953, and every future PR touching anything in theunit-testsmatrix.