Skip to content

Show total progress in terminal during testing #2657

@nicoddemus

Description

@nicoddemus

This is a proposal to change the terminal output while running tests to include the total tests ran so far and the total tests still to run, or percentage of the total tests executed so far.

Currently here's the normal pytest output (minus header):

============================= test session starts =============================
collected 1909 items

testing\acceptance_test.py ...............s................................x.............
testing\deprecated_test.py ......
testing\test_argcomplete.py ss
testing\test_assertion.py ........................................................................s.......
<snip>

What I propose is:

============================= test session starts ===============================
collected 1909 items

testing\acceptance_test.py ...............s............................ [44/1909]
                           ....x.............                           [62/1909]
testing\deprecated_test.py ......                                       [68/1909]
testing\test_argcomplete.py ss                                          [70/1909]
testing\test_assertion.py ............................................ [114/1909]
                          ............................s.......         [150/1909] 
<snip>

This would be a better view of the overall progress and how much tests are still left on the run.

Alternatively instead of showing test counts we could just show a percentage of the total run so far:

============================= test session starts ===============================
collected 1909 items

testing\acceptance_test.py ...............s................................ [ 2%]
                           ....x.........                                   [ 3%]
testing\deprecated_test.py ......                                           [ 3%]
testing\test_argcomplete.py ss                                              [ 3%]
testing\test_assertion.py ................................................. [ 5%]
                          ............................s.                    [ 7%] 
<snip>

Thoughts? cc @RonnyPfannschmidt @hpk42 @The-Compiler @hackebrot

Side note

This idea came to be because it Jenkins (it seems) only updates its console view when the process outputs a new line. When running with xdist, pytest only prints a . per test, only printing a new line at the end of the session, so the output windows doesn't update until the end of the run.

Changing the output to the one proposed here would fix that and also provide a nice user experience (IMO).

Metadata

Metadata

Assignees

Labels

topic: reportingrelated to terminal output and user-facing messages and errorstype: enhancementnew feature or API change, should be merged into features branch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions