Skip to content

fix: prevent Rich from wrapping non-callable-main error across lines#35

Merged
vikranthreddimasu merged 1 commit into
masterfrom
fix/cli-non-callable-main-wrap
Jun 26, 2026
Merged

fix: prevent Rich from wrapping non-callable-main error across lines#35
vikranthreddimasu merged 1 commit into
masterfrom
fix/cli-non-callable-main-wrap

Conversation

@vikranthreddimasu

Copy link
Copy Markdown
Owner

Summary

  • Bug: test_train_script_reports_non_callable_main was failing because Rich's console.print() word-wrapped a long error message at the default terminal width, splitting "not callable" across two lines as "not\ncallable".
  • Root cause: The error message "Error: Script attribute 'main' in <path> is not callable." contains a long file path. When the path pushes the line over Rich's wrap column, it splits at a word boundary — landing the break between "not" and "callable", so the assertion "not callable" in result.output fails.
  • Fix: Added soft_wrap=True to the single console.print() call that emits this message (macfleet/cli/main.py:864). soft_wrap=True disables Rich's word-wrapping for that line, keeping the phrase intact regardless of path length.

Test plan

  • pytest tests/test_cli/test_train_script.py::test_train_script_reports_non_callable_main — now passes
  • Full suite pytest tests/ -q — 681 passed, 12 skipped, 0 failed
  • ruff check macfleet/ tests/ — all checks passed

🤖 Generated with Claude Code

https://claude.ai/code/session_013EMfjMjNvvj1p3HYjbJXQe


Generated by Claude Code

Rich's console.print() was word-wrapping a long error message at the
default terminal width, splitting the phrase "not callable" across two
lines ("not\ncallable"). This caused the test assertion
`"not callable" in result.output` to fail.

Adding soft_wrap=True to the affected print call disables Rich's
word-wrapping for that line, keeping the key phrase on a single line
regardless of the path length.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013EMfjMjNvvj1p3HYjbJXQe
@vikranthreddimasu vikranthreddimasu merged commit 8741e82 into master Jun 26, 2026
4 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants