#3829 -- Add the ability to show test progress as number of tests completed instead of a percent.#3880
Conversation
|
Thanks for tackling this @jeffreyrack! The counter text is going over the edge when the number of tests make the progress doesn't fit on a single line, at least for me on Windows: How does it look on your system? Also with I think there should be a space between them: Finally, a little of bike shedding: I think we don't need the space between brackets and the numbers: |
|
About where to put the docs: we should put the new option in |
nicoddemus
left a comment
There was a problem hiding this comment.
Also take a look at _PROGRESS_LENGTH and where it is used to fix the "past the edge" problem I mentioned. 👍
…st progress for count console output style.
src/_pytest/terminal.py
Outdated
| if self.config.getoption("setupshow"): | ||
| return False | ||
| return self.config.getini("console_output_style") == "progress" | ||
| return ( |
There was a problem hiding this comment.
I suggest to use simply:
return self.config.getini("console_output_style") in ("progress", "count")
src/_pytest/terminal.py
Outdated
| if self.config.getini("console_output_style") == "count": | ||
| num_tests = self._session.testscollected | ||
| _PROGRESS_LENGTH = len( | ||
| " [ {} / {} ]".format(str(num_tests), str(num_tests)) |
There was a problem hiding this comment.
What do you think about using " [{}/{}]" here?
src/_pytest/terminal.py
Outdated
| def pytest_runtest_logfinish(self, nodeid): | ||
| if self.config.getini("console_output_style") == "count": | ||
| num_tests = self._session.testscollected | ||
| _PROGRESS_LENGTH = len( |
There was a problem hiding this comment.
Now that this is no longer a constant, this should be lower case to conform to PEP-8: progress_length
| counter_format = "{{:{}d}}".format(len(str(collected))) | ||
| format_string = " [ {} / {{}} ]".format(counter_format) | ||
| return format_string.format(len(progress), collected) | ||
| return " [ {} / {} ]".format(collected, collected) |
Codecov Report
@@ Coverage Diff @@
## features #3880 +/- ##
===========================================
Coverage ? 92.64%
===========================================
Files ? 51
Lines ? 9975
Branches ? 0
===========================================
Hits ? 9241
Misses ? 734
Partials ? 0
Continue to review full report at Codecov.
|
nicoddemus
left a comment
There was a problem hiding this comment.
Great work @jeffreyrack, thanks!
Implements #3829 by adding a config value that can be used to show the test progress as the number of completed tests instead of a percentage complete.
Wasn't sure where to add the documentation for this, but am willing to go and add it if somebody can suggest a good spot to mention the new config value in.