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

Status line length miscalculation #217

Open
zajosk opened this issue Oct 26, 2020 · 0 comments
Open

Status line length miscalculation #217

zajosk opened this issue Oct 26, 2020 · 0 comments

Comments

@zajosk
Copy link

zajosk commented Oct 26, 2020

When multiple tests are in a single test file, the test result progress bar gets printed for each test in the file, when using pytest-sugar in a windows powershell terminal. Example output:

Command:

pytest .\tests\test_1.py

Output:

Test session starts (platform: win32, Python 3.8.5, pytest 6.1.1, pytest-sugar 0.9.4)  
rootdir: ..., configfile: pytest.ini
plugins: forked-1.3.0, mock-3.3.1, pspec-0.0.4, sugar-0.9.4, xdist-2.1.0
collecting ... 
 test_1.py ✓                                                         25% ██▌       
 test_1.py ✓✓                                                        50% █████     
 test_1.py ✓✓✓                                                       75% ███████▌  
 test_1.py ✓✓✓✓                                                     100% ██████████

Results (0.30s):
       4 passed

The progressbar is rendered so, that it ends right on the right window margin (last character is used by the progressbar)

I could get it fixed locally by either setting LEN_RIGHT_MARGIN to 1 or inside SugarTerminalReporter.insert_progress by adding 1 less space (num_spaces -1), but I don't know, if these are the correct fixes for the issue.

I believe some part of the calculation of number of needed spaces to insert into the status line is broken, because for in test runs with errors the lines with "-" or "=" padding are always 1 character shorter than the line with the status line

@Teemu Teemu added the dont-know label Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants