Skip to main content

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)

Uploaded Source

Built Distribution

simple_coverage-0.1.1-py3-none-any.whl (2.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page