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

Supporting no stdout, fix force color bug #2513

Merged
merged 17 commits into from Sep 8, 2022
Merged

Conversation

darrenburns
Copy link
Member

@darrenburns darrenburns commented Sep 7, 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

Fixes #2400.

Ensures RIch can run when stdout is not available (for example from pythonw).

I've tested on a Windows machine and ensured that you can use a console (and capture from it) as expected when using python.

Also fixes the issue with FORCE_COLOR.

image

image

@codecov-commenter
Copy link

codecov-commenter commented Sep 7, 2022

Codecov Report

Merging #2513 (f996337) into master (3b7728b) will increase coverage by 2.97%.
The diff coverage is 91.46%.

@@            Coverage Diff             @@
##           master    #2513      +/-   ##
==========================================
+ Coverage   95.67%   98.64%   +2.97%     
==========================================
  Files          72       73       +1     
  Lines        7767     7832      +65     
==========================================
+ Hits         7431     7726     +295     
+ Misses        336      106     -230     
Flag Coverage Δ
unittests 98.64% <91.46%> (+2.97%) ⬆️

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

Impacted Files Coverage Δ
rich/box.py 100.00% <ø> (ø)
rich/color.py 100.00% <ø> (ø)
rich/scope.py 100.00% <ø> (ø)
rich/console.py 98.01% <69.23%> (+1.29%) ⬆️
rich/logging.py 97.43% <75.00%> (-2.57%) ⬇️
rich/pretty.py 98.97% <90.00%> (-0.26%) ⬇️
rich/_null_file.py 100.00% <100.00%> (ø)
rich/repr.py 100.00% <100.00%> (ø)
rich/cells.py 100.00% <0.00%> (+3.94%) ⬆️
... and 2 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@darrenburns darrenburns linked an issue Sep 8, 2022 that may be closed by this pull request
@darrenburns darrenburns marked this pull request as ready for review September 8, 2022 10:31
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.

Might want to add a test for the correct behaviour when FORCE_COLOR is empty string

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] AttributeError using Console.capture when run with pythonw
3 participants