How to know time spent on each test when using unittest?

前端 未结 7 1404
-上瘾入骨i
-上瘾入骨i 2021-02-05 00:37

Unittest presents only total time spent on running all tests but does not present time spent on each test separately.

How to add timing of each test when using unittest?

7条回答
  •  一个人的身影
    2021-02-05 01:00

    PyCharm CE (free) provides a clean view of unittest durations. It also helpfully aggregates by directory structure and file and allows you to sort by duration:

    And as @horejsek mentioned, there's an issue for unittest to add duration measurement with an open PR: https://github.com/python/cpython/pull/12271.

提交回复
热议问题