Skip to content
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

Handle recording on legacy mode Windows consoles #2066

Merged
merged 11 commits into from Mar 18, 2022

Conversation

darrenburns
Copy link
Member

@darrenburns darrenburns commented Mar 15, 2022

Type of changes

  • Bug fix
  • New feature
  • Documentation / docstrings
  • Tests
  • Other

Checklist

  • I've run the latest black with default args on new code.
  • I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
  • I've added tests for new code.
  • I accept that @willmcgugan may be pedantic in the code review.

Description

Console.record=True was only being handled inside _render_buffer, which was not called on legacy mode consoles.

I've extracted the code for recording the buffer out of this method, to ensure it gets called regardless of environment.

Closes #2053

@codecov-commenter
Copy link

codecov-commenter commented Mar 15, 2022

Codecov Report

Merging #2066 (1d61867) into master (e552771) will decrease coverage by 3.09%.
The diff coverage is 78.57%.

@@            Coverage Diff             @@
##           master    #2066      +/-   ##
==========================================
- Coverage   99.52%   96.42%   -3.10%     
==========================================
  Files          72       72              
  Lines        7335     7337       +2     
==========================================
- Hits         7300     7075     -225     
- Misses         35      262     +227     
Flag Coverage Δ
unittests 96.42% <78.57%> (-3.10%) ⬇️

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

Impacted Files Coverage Δ
rich/__init__.py 100.00% <ø> (ø)
rich/highlighter.py 100.00% <ø> (ø)
rich/_win32_console.py 3.19% <33.33%> (-88.26%) ⬇️
rich/console.py 97.53% <40.00%> (-1.97%) ⬇️
rich/segment.py 99.03% <93.75%> (-0.31%) ⬇️
rich/cells.py 100.00% <100.00%> (ø)
rich/control.py 100.00% <100.00%> (ø)
rich/pager.py 100.00% <100.00%> (ø)
rich/protocol.py 100.00% <100.00%> (ø)
rich/traceback.py 99.55% <100.00%> (ø)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e552771...1d61867. Read the comment docs.

rich/console.py Outdated Show resolved Hide resolved
rich/console.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@willmcgugan willmcgugan left a comment

Choose a reason for hiding this comment

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

LGTM

@darrenburns
Copy link
Member Author

@willmcgugan pty module doesn't work on Windows. Has a comment at the top of it too saying it's only tested on Unix and MacOS.

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.

[BUG] Rich 12.0.0 fails to write to stdout attached to a pipe on Windows
3 participants