-
Notifications
You must be signed in to change notification settings - Fork 21
Prevent pytest fail with non unicode chars #1384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
⚡️ Codeflash found optimizations for this PR📄 32% (0.32x) speedup for
|
PR Review Summary✅ Prek ChecksAll prek checks (ruff check, ruff format) passed successfully. No linting or formatting issues detected.
|
| File | Statements | Missed | Coverage |
|---|---|---|---|
| shell_utils.py | 149 | 60 | 60% |
| PrComment.py | 34 | 10 | 71% |
| find_references.py | 324 | 46 | 86% |
| parse.py | 191 | 90 | 53% |
| vitest_runner.py | 188 | 44 | 77% |
| treesitter_utils.py | 729 | 56 | 92% |
| function_optimizer.py | 1152 | 940 | 18% |
| TOTAL | 2767 | 1246 | 55% |
Analysis:
- The core fix (shell_utils.py line 253) is in a function with 60% coverage
- Most changes are cosmetic (noqa comments, formatting) and don't affect coverage
- No new files added
- Test results: 8 failed, 2195 passed (failures appear unrelated to this PR - they're in test_tracer.py)
Note: Cannot compare with main branch coverage as git operations require approval. The changes are minimal and primarily add error handling for non-UTF-8 output.
🎯 Code Review Issues
1. Type ignore comments violate project standards (HIGH PRIORITY)
- Location:
codeflash/github/PrComment.py:34, 48, 49, 51 - Issue: Using
# type: ignoreto suppress type errors instead of fixing root causes - Fix: Remove type: ignore comments and properly type the method return value
2. Core fix looks correct
- Location:
codeflash/code_utils/shell_utils.py:253 - The addition of
errors='replace'to subprocess.run() args is a valid approach to handle non-UTF-8 bytes - This prevents UnicodeDecodeError when pytest output contains non-unicode characters
🤖 Pending Optimization PRs
Found 30 open optimization PRs from codeflash-ai[bot]. However, most have failing CI checks:
- PR ⚡️ Speed up function
get_analyzer_for_fileby 32% in PR #1384 (non-unicode-pytest-fail) #1385 (related to this PR) - FAILING (multiple CI checks fail) - PR ⚡️ Speed up method
PrComment.to_jsonby 329% in PR #1318 (fix/js-jest30-loop-runner) #1383 - FAILING (prek, pr-review, windows-unit-tests fail) - Most other PRs also have failing checks
Recommendation: Do not merge any optimization PRs until CI checks pass.
Last updated: 2026-02-04
|
@claude review this |
|
Claude finished @aseembits93's task in 1m 27s —— View job Code Review Complete ✓OverviewThis PR addresses non-UTF-8 character handling in pytest output and adds linter suppressions. The main fix is solid, but there are critical issues that must be addressed before merging. Critical Issues ❌1. Type Ignore Comments Violate Project Standards (BLOCKING)Location: Issue: The PR adds
Problem Analysis: result: dict[str, Union[str, int, dict[str, dict[str, int]], list[BenchmarkDetail], None]] = { # type: ignore[no-redef]
...
}The type error occurs because:
Required Fix:
Approved Changes ✓Core Fix: Non-UTF-8 HandlingLocation: Change: if text:
run_args["errors"] = "replace"Assessment: ✅ EXCELLENT
Minor Issues (Non-blocking)2. Linter SuppressionsLocations: Multiple files Changes:
Assessment: These suppressions are valid for existing code patterns, but:
Recommendation: These are acceptable but ideally should be addressed in a separate refactoring PR. 3. Import FormattingLocation: Change: Multi-line import consolidated to single line. Assessment: ✅ Style change, non-functional. Acceptable. 4. String ConcatenationLocation: Change: Multi-line f-string consolidated to single line. Assessment: ✅ Style change, non-functional. Acceptable. Testing StatusBased on the previous review:
RecommendationsMust Do Before Merge:
Optional Improvements:
SummaryVerdict: The core fix (shell_utils.py) is excellent and solves the stated problem correctly. However, the Impact: Once the type ignore comments are fixed, this PR will:
Branch: |
|
@claude rebase on top of main to fix the merge conflicts |
|
I'll analyze this and get back to you. |

No description provided.