Old-Shatterhand / pytest_assertcount

Pytest Plugin to count actual number of asserts in a pytest run

Home Page:https://pypi.org/project/pytest-assertcount/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AssertCount

A pytest plugin to count the actual number of asserts in a pytest run.

Installation

The package is available on the python package index and can be installed using

pip install pytest_assertcount

and it can be updated using

pip install --upgrade pytest_assertcount

Output

The output will be shown as the second last result in the pytest output, right above short test summary info.
Example:

...
===== assert statistics =====
total asserts : 1
passed asserts: 1 (100%)
failed asserts: 0 (0%)
== short test summary info ==
...

Restrictions

This plugin to only able to count "non-trivial" asserts, so

assert scoring("a", "b") == 10

would work for some given scoring function, but

assert 2*3 == 10

would not be counted, as it's a pointless assert.

Furthermore, only asserts in the test files will be counted. Asserts in external files with functions called during testing are not counted.

About

Pytest Plugin to count actual number of asserts in a pytest run

https://pypi.org/project/pytest-assertcount/

License:MIT License


Languages

Language:Python 100.0%