mdmintz / pynose

pynose fixes nose to extend unittest and make testing easier
https://pypi.org/project/pynose/
GNU Lesser General Public License v2.1
14 stars 6 forks source link

Prevent the line separator during test results from wrapping over to the next line #40

Closed mdmintz closed 2 months ago

mdmintz commented 2 months ago

Prevent the line separator during test results from wrapping over to the next line

Currently, something like this could happen if the terminal width is less than 70:

Screenshot 2024-09-21 at 4 13 02 PM

That separator comes from unittest: unittest.TextTestResult.separator2:

https://github.com/mdmintz/pynose/blob/25a7dbbba3abaf60e7b79f73f3ab3d5a30cc2251/nose/result.py#L98

The call always prints 70 dashes. If the screen size is less than that, it should only print dashes for the width of the window. If the window size is greater than or equal to 70, then it should only print 70 dashes, like before.

I can get the terminal width by using: os.get_terminal_size().columns

I'll set the minimum width to 26. If there's an error calculating the width, I'll set the separator at 40 dashes.