Skip to content

Latest commit

 

History

History
42 lines (27 loc) · 950 Bytes

File metadata and controls

42 lines (27 loc) · 950 Bytes

pytest-circleci-coverage

A pytest plugin that works with pytest-cov to generate coverage data for CircleCI's Smarter Testing.

Usage

Install the plugin via git.

python -m pip install git+https://github.com/circleci/pytest-circleci-coverage.git

Install pytest-cov.

Run pytest with coverage and the --circleci-coverage flag to generate coverage JSON.

pytest --cov --cov-context=test --circleci-coverage=coverage.json

Development

Running tests

Install the plugin locally in editable mode.

pip install --editable .

Run tests.

pytest

To 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