Simple Coverage measurements for Python
Project description
simple-coverage
Very basic coverage tool for educational purposes.
Installation
pip install simple-coverage
Usage
Just import the package and add the @coverage decorator about functions you want to inspect.
from simple_coverage.coverage import coverage
@coverage
def demo(x, y) -> bool:
"""
Demo function
"""
product = x * y
if product < 10:
return product * 2
else:
return product
if __name__ == "__main__":
demo(3,5)
When simply runnning the Python-file, this will create the following output:
Function: demo(3, 5)
CALLED line 9: product = x * y
CALLED line 10: if product < 10:
MISSED line 11: return product * 2
IGNORE line 12: else:
CALLED line 13: return product
Instruction coverage: 75.0 %
Branch coverage: 50.0 %
Note
- It is currently not compatible with coverage.py or pytest since it uses the same underlying system tracer.
- It only analyses the coverage for each function call seperately.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
simple_coverage-0.1.1.tar.gz
(2.4 kB
view hashes)
Built Distribution
Close
Hashes for simple_coverage-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5596b7f7f7d59c69718616be31e52852dd96eb99847af24feed97a6d470b2140 |
|
MD5 | 2d889c298cdf024ca383f848e6f0d2d0 |
|
BLAKE2b-256 | 4d11b144809cb7c1615868491753a29ac7caad4a1e186980d819749d71583136 |