Skip to content

Process backspaces in output to fix test on groff-1.23.0#422

Merged
blink1073 merged 1 commit intoCalysto:mainfrom
mgorny:fix-man-test
Mar 24, 2026
Merged

Process backspaces in output to fix test on groff-1.23.0#422
blink1073 merged 1 commit intoCalysto:mainfrom
mgorny:fix-man-test

Conversation

@mgorny
Copy link
Copy Markdown
Contributor

@mgorny mgorny commented Mar 24, 2026

References

Fixes #266

Description

Strip backspaces along with the preceding characters from man sleep output in tests, in order to normalize the output and make the test pass irrespective of groff version.

Changes

See "description".

Backwards-incompatible changes

None

Testing

pytest tests/test_replwrap.py::REPLWrapTestCase::test_bash

AI usage

  • Some or all of the content of this PR was generated by AI.
  • The human author has carefully reviewed this PR and run this code.
  • AI tools and models used: None

Strip backspaces along with the preceding characters from `man sleep`
output in tests, in order to normalize the output and make the test pass
irrespective of groff version.

Fixes Calysto#266

Signed-off-by: Michał Górny <mgorny@gentoo.org>
Copy link
Copy Markdown
Contributor

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@blink1073 blink1073 added the bug label Mar 24, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.30%. Comparing base (271e93a) to head (57214fe).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #422   +/-   ##
=======================================
  Coverage   90.30%   90.30%           
=======================================
  Files          51       51           
  Lines        2950     2950           
  Branches      414      414           
=======================================
  Hits         2664     2664           
  Misses        209      209           
  Partials       77       77           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@blink1073 blink1073 merged commit 98b3f50 into Calysto:main Mar 24, 2026
35 of 38 checks passed
Comment on lines -36 to +39
res = bash.run_command("man sleep", timeout=2)
assert "SLEEP" in res, res
res = bash.run_command("NO_COLOR=1 man sleep", timeout=2)
# groff-1.23.0 uses backspaces in output. Strip them along with
# the preceding character to normalize the tested result.
assert "SLEEP" in re.sub(r".\x08", "", res), res
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about bash.run_command("NO_COLOR=1 man sleep | col -b", timeout=2)?

I don't know if pipes can be used there, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

metakernel/tests/test_replwrap.py::REPLWrapTestCase::test_bash fails because of control codes in man(1) output

3 participants