-
Notifications
You must be signed in to change notification settings - Fork 163
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
Improve Test
to use colors to highlight failures and diffs
#4170
Conversation
c0845a8
to
7e12354
Compare
Does this make the output hard to read in less, and similar programs, by filling them with colour codes? (does GAPDoc already handle this by dropping them based on where stdout is going?) |
I've never ever tried to send the output of So I just tried |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do like the idea of colours in the output. However, I use a terminal with a white background, and the yellow text on a white background is unpleasant to read.
Could you find a solution for the currently-yellow text that has high contrast with both light and dark terminal backgrounds? Or perhaps only colour the #######
bit (which doesn't actually need to be read), and leave the other yellow text as it was?
Yeah colors could be tweaked; I also wonder about people who are red-green blind. |
Can you deliberately break some more tests for testing this PR, so that we can see how GitHub actions will render colours. |
@wilfwilson there are some more colors we could pick from. Also, background color can be used, and of course any combination for foreground and background color could be used. But of course most terminals also allow overriding these colors, so there won't be a single "optimal" choice, ever... julia has a @alex-konovalov GitHub Actions renders the colors just fine, see e.g |
7e12354
to
f46bc4e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I'm happy enough with it as it is.
@alex-konovalov GH Actions handles the colors just fine. But I introduced a failure so you can look for yourself, e.g. at https://github.com/gap-system/gap/pull/4170/checks?check_run_id=1427795100 @wilfwilson well, I am really open to change the colors, I just don't know what a good compromise might be. Perhaps one could explicitly set foreground and background color to increase the chance of good contrast? Playing with the code to change the colors is relatively easy. |
I had thought about it a bit, and didn't feel that I could suggest an improvement. However I have thought about it a bit more. I think combining text and bg colours is a good way to make sure that the text looks decent in light and dark terminal windows. And this is my preference (not strongly held opinion though):
Here are those styles on white/black terminal backgrounds: I think they're all quite clear. |
f46bc4e
to
02d5cff
Compare
That's fine by me; but of course it won't be perfect in all cases: someone might have a terminal theme with a very bright red and a super dark green... There are terminals which allow specifying 24bit RGB values... but I guess that's overkill ;-). Anyway, I used your color suggestions (with yellow-on-black), and also made these potentially configurable via a global record |
Yes, but although it might look ugly in some bizarre terminal setups, hopefully it'll all still be readable 🙂 Thanks. I'm happy with it. The record is a good idea. |
02d5cff
to
a9dcea9
Compare
A few comments, since I have experimented a bit with colors in terminals:
|
210e65a
to
2199f52
Compare
Codecov Report
@@ Coverage Diff @@
## master #4170 +/- ##
==========================================
+ Coverage 80.17% 81.83% +1.65%
==========================================
Files 637 637
Lines 272021 272660 +639
==========================================
+ Hits 218086 223123 +5037
+ Misses 53935 49537 -4398
|
I changed it to blue now, which looks OK for me in various terminal theme choices (but of course you can always find places where any choice is problematic, e.g. if someone really loves a blue background for their terminal.... though at least in my terminal, I would then also change the "blue color" to be something else)
While I am not a fan of them, but for this purpose I think they make sense, because they make it possible to "see" whitespace issues, which often are an annoying source of test diffs.
Good point, and added.
I'll need to look into the userpref mechanism to see whether I can do it / whether to put it in this PR or a follow-up. |
Test
I'm happy with this. |
2199f52
to
5c49b83
Compare
... to make it easier to see and understand diffs.
5c49b83
to
07c69bc
Compare
I'd rather not delay this for adding UserPreference: the colors already are customizable by tweaking |
Test
Test
to use colors to highlight failures and diffs
... and some other test code, to make it easier to see and understand diffs in there.
Consider this test file:
This will actually cause a test failure, due to whitespace, which makes it annoying to discover. Currently,
Test
will produce something like this:With this PR, you'll get this:
This change is IMHO useful beyond better understanding whitespace diffs. For example when I run the GAP test suite and there are multiple failures, it can be challenging to visually parse what is being displayed. With this PR, I find it much easier to understand what is going on.
Here is a more complex example:
Which currently produces this, which I find hard to make sense out (basically, I resorted to trying to fix the first one and then hope I can repeat this; or I use the
rewriteFile:=true
option):With this PR (the output could still be nicer, but it's a start):