Skip to content

Fix forcing color through termcolor #217

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

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

mikelolasagasti
Copy link
Contributor

Since termcolor 2.1.0, the library will now detect whether or not the process is running a TTY and disable outputting color if so. This broke using the --color argument to force color when piping to another process (e.g. less), as well as our pytest function for checking rendered output.

The fix is ensuring that we set the environment variable FORCE_COLOR in the cases where we want color, and might not have a TTY (e.g. in the pytest, or when using --color option).

Fixes #210

Since termcolor 2.1.0, the library will now detect whether or not the
process is running a TTY and disable outputting color if so. This broke
using the `--color` argument to force color when piping to another
process (e.g. `less`), as well as our pytest function for checking
rendered output.

The fix is ensuring that we set the environment variable FORCE_COLOR in
the cases where we want color, and might not have a TTY (e.g. in the
pytest, or when using `--color` option).
Copy link
Contributor

@jonbannister jonbannister 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 for your contribution. Sorry for the delay!

@jonbannister jonbannister merged commit 00895eb into man-group:master Oct 4, 2024
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.

shutil: tests/unit/test_cmdline.py::test_pretty_formatter fails with termcolor >= 2.1.0
2 participants