Skip to content

False negatives for function calls splitted along multiple lines #270

@m-aciek

Description

@m-aciek

Hi, thanks for this library. It is very helpful in our project!

I think I found an issue, false negative, that affects overall quality of diff-cover check in a specific use case.

I use diff-cover 6.4.4 with coverage.py in version 6.2 through pytest-cov in version 3.0.0 with Cobertura XML report.

  • Recently I updated function call in my production code (the signature of the function I use changed, it has a new argument, and I've added new keyword argument to the call)
  • This production call has no test coverage.
  • Diff-cover doesn't fail for the line with a new argument in the function call.

Expected:

  • Diff-cover fails for the line with a new argument in function call because of lack of the coverage.

Details: I think that probably diff-cover ignores lines without coverage report, and probably (?) it should for every changed line in diff search for first line above with reported coverage. On the image below red line point to lines not covered by tests (GitLab supports Cobertura reports).

Zrzut ekranu 2022-01-17 o 12 33 36

Zrzut ekranu 2022-01-17 o 12 33 49

$ diff-cover coverage.xml --fail-under 100 --html-report diff-cover.html --compare-branch origin/develop
-------------
Diff Coverage
Diff: origin/develop...HEAD, staged and unstaged changes
-------------
…/file_on_screenshot.py (100%)
…/obfuscated.py (100%)
…/obfuscated2.py (100%)
-------------
Total:   13 lines
Missing: 0 lines
Coverage: 100%
-------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions