-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
gh-129363: Added colored printing for python -m test
without the -j
flag
#129364
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
Conversation
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
python -m test
without -j
flagpython -m test
without the -j
flag
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.
Thanks for this!
This isn't technically a bug, but does look like an improvement.
Now
Currently, yellow is shown for for skips, red for fail, and green when the time is shown:

What's going on is, the name is shown when it begins, and if it takes longer than 30 seconds to run, only then do we print an explicit result (with colour).
Those uncoloured lines are only stating the test started, and we don't show the result.
PR
The PR doesn't only add colour but changes functionality as well. Now it shows the result after it's finished running, and we don't get the uncoloured "start" line:

I think this an improvement? It makes it clear the test actually passed.
Comparison
Plus before, we'd get uncoloured .test_processes
to show it's started, then when it completes, it prints uncoloured .test_threads
to show the next test has started, but then a green .test_processes
on the same line to show it's actually finished.
This is a little unclear to have the slow completion report show up after the bit about the next test starting:

However, with this PR, we only get the success lines:

cc @vstinner as well.
if ( | ||
result.duration | ||
and result.duration >= PROGRESS_MIN_TIME | ||
and not self.pgo |
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.
Why check PGO? I don't think this was relevant before?
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 dislike the new behavior. It doesn't show the name of the test currently running. If a test takes 1 minute, for 1 minute, it says nothing. I prefer to know what's going on, which test is running.
I would prefer:
[ 1/484] test.test_asyncio.test_base_events
[ 1/484] test.test_asyncio.test_base_events passed
[ 2/484] test.test_asyncio.test_buffered_proto
[ 2/484] test.test_asyncio.test_buffered_proto passed
...
where the second line "passed" is green.
It's more verbose, but it's more explicit what's going on. Especially when a test is stuck.
I wrote PR gh-129476 which does what I want :-) Please have a look. |
#129476 was merged instead. Thanks for your contribution anyway @MarcinKonowalczyk! |
yup, sorry, fell out the loop on this one. in favour of #129476 ! :)) |
Fixes #129363. New version based on
RunWorkers::display_result
.python -m test
color print with and without-j
#129363