Skip to content

tests: make tests compatible with rich 14.3.3#1678

Closed
mcepl wants to merge 1 commit into
python-cmd2:mainfrom
openSUSE-Python:stylize_tests
Closed

tests: make tests compatible with rich 14.3.3#1678
mcepl wants to merge 1 commit into
python-cmd2:mainfrom
openSUSE-Python:stylize_tests

Conversation

@mcepl
Copy link
Copy Markdown

@mcepl mcepl commented Jun 6, 2026

It seems that with the upgrade to rich 14.3.3 (what we have in openSUSE/Tumbleweed) stylize function eats EOLs. I have modified tests to acommodate that, and I hope it should be universal enough so that even with older versions of rich nothing should break.

It seems that with the upgrade to rich 14.3.3 (what we have in
openSUSE/Tumbleweed) `stylize` function eats EOLs. I have modified tests
to acommodate that, and I hope it should be universal enough so that
even with older versions of rich nothing should break.

Signed-off-by: Matěj Cepl <mcepl@cepl.eu>
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.59%. Comparing base (dc266d8) to head (42afcf3).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1678   +/-   ##
=======================================
  Coverage   99.59%   99.59%           
=======================================
  Files          23       23           
  Lines        5677     5677           
=======================================
  Hits         5654     5654           
  Misses         23       23           
Flag Coverage Δ
unittests 99.59% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@tleonhardt
Copy link
Copy Markdown
Member

tleonhardt commented Jun 6, 2026

@mcepl What version of cmd2 are you packaging in openSUSE/Tumbleweed? I ask because there have been a lot of little changes and bug fixes in recent versions of rich and cmd2 4.0.0 requires rich >= 15.0.0. Even cmd2 3.5.1, the latest version in the 3.x line, also requires rich >= 15.0.0.

@kmvanbrunt is intimately familiar with the recent rich releases and what bug fixes were in each, so he is the one that should review this as a potential change.

Regardless, you could need to run ruff format first to comply with our auto-formatting rules. We have a make check convenience command built into our repo which runs all of our auto-formatting and linting checks using prek.

@kmvanbrunt
Copy link
Copy Markdown
Member

The issue isn't with cmd2. Rich fixed a bug in version 15.0.0 where Text.from_ansi() didn't preserve all trailing newlines. Prior to their fix, cmd2 included a monkey patch that resolved this bug.

You are using a setup with a new version of cmd2 (no monkey patch) and an old version of Rich (14.3.3) which does not include the fix. It's an incompatible configuration. As @tleonhardt mentioned, cmd2 requires rich >=15.0.0

@kmvanbrunt kmvanbrunt closed this Jun 6, 2026
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.

3 participants