Creates a set of all lines that have no test coverage in the current git diff
Project description
missing_diff_lines
Run missing_diff_lines()
after you ran coverage.py
in a git-repo, e.g. with coverage run -m unittest discover
.
It will output a set with tuples in the form (filename, line-number)
for every line in the current diff, that has no test that
covers it.
Example
Say you have this code in calc.py
and no tests yet:
def mul(a, b):
return a * b
You add some more cod:
def mul(a, b):
return a * b
def div(a, b):
if b == 0:
return 0
return a / b
As well as a test-suite:
class TestDiv(TestCase):
def test_simple_div(self):
self.assertEqual(3, div(9, 3))
Note, that the branch b == 0
is not covered.
And indeed. if you run:
$ coverage run -m unittest discover && python3 report.py
Where this is the content of report.py
:
from missing_diff_lines import missing_diff_lines
from pprint import pprint
print(missing_diff_lines())
You get
{('calc.py', 6)}
Which is correct, as this line is not covered. But note, that the not covered line 2 is not in the current diff and thus is not reported. This is the very purpose of this package.
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
Built Distribution
File details
Details for the file missing_diff_lines-0.0.4.tar.gz
.
File metadata
- Download URL: missing_diff_lines-0.0.4.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93b3bdd03cd43671820f19626df2f86e310896a3e37ce2b8ecdaf297bfc32d86 |
|
MD5 | afd8f6df68e3a9354e4ed5939f81b8aa |
|
BLAKE2b-256 | 2ac582daf3700a7b8150ffcf0898ba7a352cb877e47661f6ede6406f25308125 |
File details
Details for the file missing_diff_lines-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: missing_diff_lines-0.0.4-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5398c3b155f49bcf667cc19c245503a504d8c76ce737650747c1f167ea47754 |
|
MD5 | b9578cf1eb00cce90a0da948f5ddf307 |
|
BLAKE2b-256 | e9471e43a2bc4c9af993810d2b5b6c0e1b7f6fac2b18b30794119bdba11a98a9 |