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

Functional test of colour output #6467

Open
MetRonnie opened this issue Nov 7, 2024 · 0 comments
Open

Functional test of colour output #6467

MetRonnie opened this issue Nov 7, 2024 · 0 comments
Labels
bug? Not sure if this is a bug or not
Milestone

Comments

@MetRonnie
Copy link
Member

MetRonnie commented Nov 7, 2024

There is a problem with this test

script -q -c "cylc scan -t rich --color=never" log > /dev/null 2>&1
grep_fail "$ANSI" log -P # no color

A color reset char is included on the last line of the output:

Script started on 2024-11-07 18:11:50+00:00 [TERM="xterm-256color" TTY="/dev/pts/1" COLUMNS="202" LINES="13"]
�[0m
Script done on 2024-11-07 18:11:53+00:00 [COMMAND_EXIT_CODE="0"]

This is despite autoreset=False and use_color=False (strip=True) here:

color_init(autoreset=False, strip=not use_color)

Whether this is just some strange interaction between colorama and the script command used in the test, or a bug in colorama, I'm not sure.


N.B. I had a look at how colorama works. It bills itself as a package meant only for making colour work on Windows, but I guess we are using it for its init(strip=not use_color) function that can automatically strip ANSI color chars from print() calls (it actually patches sys.stdout and sys.stderr). However there are >100 open issues and it is in a call-for-maintainers state: tartley/colorama#300.

Originally posted by @MetRonnie in #6463 (comment)

@MetRonnie MetRonnie added this to the some-day milestone Nov 7, 2024
@MetRonnie MetRonnie added the bug? Not sure if this is a bug or not label Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug? Not sure if this is a bug or not
Projects
None yet
Development

No branches or pull requests

1 participant