support coverage badge generation from pytest --junitxml file
It would be great if we could leverage the same xml from the pytest report generation to generate the coverage badge without needing to install the coverage module.
currently the workflow would be:
# generate reports:
# test report
pytest --cov-report=html:reports/coverage --junitxml=reports/coverage/pytest_coverage.xml
# coverage report
coverage xml -o reports/coverage/coverage.xml
# generate badges
# tests badge
genbadge tests -i < reports/coverage/pytest_coverage.xml -o reports/badges/tests-badge.svg
# coverage badge
genbadge coverage -i reports/coverage/coverage.xml -o reports/badges/coverage-badge.svg
is it possible to consolidate these steps?
pytest --cov-report=html:reports/coverage --junitxml=reports/coverage/pytest_coverage.xml
genbadge tests coverage -i reports/coverage/pytest_coverage.xml -o reports/coverage/
where -o reports/coverage/ will generate badges with default names, and specifying names would require badges to be generated individually.
appreciate the project! Thanks very much
Thanks @pixelpicnic for the suggestion!
without needing to install the coverage module
pytest-cov is just a tiny wrapper of coverage so you install it already :) : https://github.com/pytest-dev/pytest-cov/blob/master/setup.py#L133
Does it change your opinion about this feature ? Otherwise I'll accept any non-destructive PR (i.e. all existing features must continue to work as is) that would implement it.
You might need to leverage click's multi command design https://stackoverflow.com/a/59391691/7262247 , hopefully this won't get too complex.
Cheers @smarie, I'll give that a shot. Thanks for the info!