Skip to main content

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.

Metadata

Release files for missing-diff-lines 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for missing-diff-lines 0.0.4
File Size Uploaded
missing_diff_lines-0.0.4.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for missing-diff-lines 0.0.4
File Interpreter ABI Platform
missing_diff_lines-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 14.9 kB

Release files / missing_diff_lines-0.0.4.tar.gz

Download URL missing_diff_lines-0.0.4.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
93b3bdd03cd43671820f19626df2f86e310896a3e37ce2b8ecdaf297bfc32d86
BLAKE2b-256 checksum
How to use checksums
2ac582daf3700a7b8150ffcf0898ba7a352cb877e47661f6ede6406f25308125
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / missing_diff_lines-0.0.4-py3-none-any.whl

Download URL missing_diff_lines-0.0.4-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5398c3b155f49bcf667cc19c245503a504d8c76ce737650747c1f167ea47754
BLAKE2b-256 checksum
How to use checksums
e9471e43a2bc4c9af993810d2b5b6c0e1b7f6fac2b18b30794119bdba11a98a9
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page