Skip to content

pytest: improve branch coverage #2501

@adamjstewart

Description

@adamjstewart

By default, coverage only reports which lines were executed during unit testing. By enabling branch coverage, we can also see whether if-statements are tested for both True and False conditions.

To enable this, simply add the following to pyproject.toml:

[tool.coverage.run]
branch = true

https://app.codecov.io/gh/microsoft/torchgeo/pull/2276/indirect-changes gives an idea of places where this coverage is missing. The real work involves adding new tests to add the missing coverage.

Reference: https://coverage.readthedocs.io/en/latest/branch.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueA good issue for a new contributor to work ontestingContinuous integration testing

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions