Functions of coverage.py
Let’s discuss coverage.py and how it helps in measuring our code coverage.
We'll cover the following...
Coverage.py is a 3rd party tool for Python that is used for measuring our code coverage.
It was originally created by Ned
Batchelder. The term “coverage” in programming circles is typically used to describe the effectiveness of our tests and how much of our code is actually covered by tests.
We can use coverage.py with Python 2.6 up to the current version of Python 3 as well as with PyPy.
If you don’t have coverage.py installed, you may do so using pip:
Examples of coverage.py
Now that we have coverage.py installed, we need some code to use it
with. Let’s use the mymath module that we created earlier in the
course. Here’s the code:
Now we need a test. Here is the code:
Testing the implementation with commands
Let’s test the below example with the commands provided in this lesson and see the ...