pythontestingpytestfunctional-testing

What's the meaning of the percentages displayed for each test on PyTest?


I'm new to testing with Pytest, and I've run into a minor but annoying hangup.

In the command line test session results, I see my tests passing, but the percentage shown is not 100%, for some tests.

With some aggressive logging, I was able to confirm that my tests are passing as expected.

My question is: what's the meaning of the percentage that is displayed for the collected tests?

Example:

platform win32 -- Python 3.7.0a4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
rootdir: C:\api-check, inifile:
collected 5 items

test_Me.py ...                                                           [ 60%]
test_env.py ..                                                           [100%]

========================== 5 passed in 6.04 seconds ===========================

Solution

  • This is a makeshift progress bar.

    It displays the "percentage of work" done so far -- most probably, total completed tests by the total number of tests to run (that it precalculated at the start).

    If your tests ran for longer, you would probably see the number in the line changing as it crunches through the specific file.