The plugin parses the .xml
coverage report and visualizes how the pull request affects the results.
Files changed | Coverage | - |
---|---|---|
calculations.py | 100.00% |
✅ |
cobertura.py | 100.00% |
✅ |
models.py | 100.00% |
✅ |
plugin.py | 100.00% |
✅ |
report.py | 100.00% |
✅ |
Run the tests using the runner that supports XML reporting. For pytest and pytest-cov add following to the setup.cfg
:
[tool:pytest]
addopts = --cov --cov-report xml:cov.xml --cov-report term
[coverage:run]
branch = True
# install danger-js
npm install -g danger
# install danger-python
pip install danger-python
# install danger-py-cov
pip install danger-py-cov
# modify dangerfile.py to include plugin
# run the tests with coverage report enabled
pytest --cov --cov-report xml:cov.xml --cov-report term
# run danger-python
danger-python pr https://github.com/elpassion/danger-py-cov/pull/2
Add following to the dangerfile.py
:
import danger_py_cov
danger_py_cov.report_coverage("cov.xml", minimum_coverage=95.0)
Make sure to run pytest
before running danger-python
.
To develop the new features, clone the repository and then run:
# install dependencies
poetry install
# activate virtual environment
poetry shell
# add pre-commit checks
pre-commit install -f -t pre-commit
# run the test suite
pytest
danger-py-cov
is released under an MIT license. See LICENSE for more information.