Skip to content

petereon/ward-coverage

Repository files navigation

Ward Coverage

CI/CD MyPy Lint Security Rating PyPI - Downloads

Disclaimer: Albeit useful already, this is a work-in-progress and should be seen as such.

A coverage plugin for Python's Ward testing framework

Example image

Installation

Build the plugin:

poetry build

and install using

pip install dist/ward_coverage-0.1.1-py3-none-any.whl

Configuration

To include coverage in your test run, add the following to your pyproject.toml:

[tool.ward]
hook_module = ["ward_coverage"]

There are several options to configure the plugin which can be included under section [tool.ward.plugins.coverage], namely:

  • report_type, defaulting to ["term"], which is a list of report types to generate. Possible values are one or more of 'lcov', 'html', 'xml', 'json', 'term'
  • threshold for minimum coverage, affecting the color the result panel has for some sort of visual cue
  • All of the options described here. Please note that everything here under [run] section goes to [tool.ward.plugins.coverage] and other sections need their separate block (e.g [tool.ward.plugins.coverage.report]) or dictionary entry within the [tool.ward.plugins.coverage] section in toml.

Example configuration

[tool.ward.plugins.coverage]
omit = ["*test*", "example.py", "**/__init__.py"]
report_type = ["term", "xml"]
source = ["."]
branch = true
relative_files = true
report = {skip_empty = true}

Contributors, issues and feature requests are welcome.