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 run testsuite "integration test" --local --test-analysis="all" && cat coverage.json | jq --sort-keys > coveragetmp.json && mv coveragetmp.json coverage.json