Important
This plugin has moved: https://github.com/CircleCI-Public/smarter-testing-plugins
A pytest plugin that works with pytest-cov to generate coverage data for CircleCI's Smarter Testing.
Install the plugin via git.
python -m pip install git+https://github.com/circleci/pytest-circleci-coverage.gitInstall pytest-cov.
Run pytest with coverage and the --circleci-coverage flag to generate coverage JSON.
pytest --cov --cov-context=test --circleci-coverage=coverage.jsonInstall the plugin locally in editable mode.
pip install --editable .Run tests.
pytestTo generate the coverage.json, used in the CI integration test.
circleci testsuite "integration test" --local --analyze-tests="all" && cat coverage.json | jq --sort-keys > coveragetmp.json && mv coveragetmp.json coverage.json