-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Percentages don't align correctly #7166
Comments
EDIT: forgot the most important info you probably need.
CPython 3.8.2 (GCC), Manjaro Linux. |
I think I have seen this a few times as well. Does it happen every time, or only some times? If it happens every time, a reproduction would be helpful. |
I've seen this as well with xdist. It seems random unfortunately, I've seen it happen, and then running the same test suite again without changing anything, for the problem to disappear. I suspect it is related to terminal character counting in |
@bluetech it happens every time, but not on our CI: https://gitlab.com/nekokatt/hikari/-/jobs/539198398 I can try and find time to put one together, but it might not be for a few days.
could it be a thread-safety/multiprocessing-safety issue somewhere? This just made me realise our CI runs a single xdist runner... so this supports that hypothesis as to why it seems to only occur on xdist :) |
I believe this is an xdist-specific issue, I've only seen it when using that -- should we move this issue to there? |
i suspect we may have a off by one error in case more than one test is in flight, which would be actually a core issue |
If I had to guess why this happens, it'd be that xdist issues e.g. the following sequence:
The way pytest works, it prints the I haven't verified this, maybe xdist does synchronize the runtest protocol between items and it's something else anyway. |
I wonder if this percentage feature can be completely disabled? Thanks! |
|
I confirmed that the cause is as described in my previous comment #7166 (comment). Possible solutions I can think of: Solution 1: Change pytest-xdist to not intermix hook calls for different item's runtestprotocol hooks. Solution 2: change pytest to not have this split printing between logreport and logfinish. So either: do everything in logfinish, but then printing the Solution 3: always display the progress at the end of the line (updated on each I'm thinking the 2nd solution with moving the progress reporting to |
This is a really petty issue, so please excuse it. I know it isn't overly important compared to most issues here.
The percentages for execution logging do not align when there is a large number of tests being run. This leads to the lines of
.
overflowing to the next line, which makes the graph become difficult to read.I have had a poke around in the code, but I do not feel comfortable trying to fix this without more time to understand what the code is doing, unfortunately.
Thanks for taking the time to look into this, greatly appreciated, we rely on Pytest heavily in our project! 👍
This was for the following raw output:
...for a total of 2,769 test cases, which leads me to think this is possibly a simple rounding issue somewhere.
Typeface: Jetbrains mono, but can repro on Droid Sans Mono and Fira Code Retina as well. The raw output suggests it isn't an issue with fonts but an issue with the number of
.
being printed -- I haven't bothered counting every single one yet. Can reproduce this on multiple terminals, such as the ones embedded in VSCode and IntelliJ IDEA.The text was updated successfully, but these errors were encountered: