[New-bugs-announce] [issue43860] unittest increment tests executed

Steve Kelem report at bugs.python.org
Fri Apr 16 01:39:02 EDT 2021

New submission from Steve Kelem <steve at kelem.net>:

The unittest module (and most other unittest modules) keep a count of the number of functional tests run, as defined by the number of times testXXXX is called.

I would like the option to count the number of times that assertXXXX is called.

I have to run many tests (in unittest's sense of the word), but each of the tests consists of iterating through an array of hundreds or thousands of individual test cases with their expected results. These check for corner cases, interior, exterior cases, and for mathematical accuracy. It doesn't make sense to make a separate test case for each test value, when iterating through an array of values, and calling AssertEquals (or whatever is called for) for each expected & actual value-pair.
Yes, the existing methodology tells me that a particular functional test works, but it is important to know whether it passed based on a single test value (because the test development is not done or the tester was lazy) or whether it passed thousands of tests and will give adequate coverage. (Yes that can be cheated too, but assume that the tests are developed in earnest.)

components: Tests
messages: 391166
nosy: chelmite
priority: normal
severity: normal
status: open
title: unittest increment tests executed
type: enhancement
versions: Python 3.9

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list