I seem to have worked it out using the tox and CircleCI configuration files shown below. It seems that what really fixed things was having tox run the pytest-based tests with a coverage command, i.e.
coverage run -m pytest tests {posargs}
I assume that by doing this it correctly makes the test coverage reports available so that codecov can then do its thing.
tox.ini
:
[tox]
envlist = py37
minversion = 3.3.0
isolated_build = true
[testenv]
passenv = CI CIRCLECI CIRCLE_* CODECOV_TOKEN
deps =
codecov
coverage
opencv-python
pytest
scikit-image
commands =
python setup.py check -m -s
coverage run -m pytest tests {posargs}
codecov
.circleci/config.yml
:
jobs:
build:
docker:
- image: circleci/python:3.7
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "requirements.txt" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: install dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install -e .
pip install codecov
pip install coverage
pip install tox
- save_cache:
paths:
- ./venv
key: v1-dependencies-{{ checksum "requirements.txt" }}
- run:
name: run tests
command: |
. venv/bin/activate
tox
- store_artifacts:
path: test-reports