From dd1f9189208255b1c83777bcb0a9fca03138ea24 Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Tue, 10 Sep 2019 23:02:29 +0800 Subject: [PATCH] Show test coverage Signed-off-by: Chenxiong Qi --- .gitignore | 1 + docker/Dockerfile-tests | 2 +- docker/Dockerfile-tests-py3 | 1 + test-requirements.txt | 3 ++- tox.ini | 3 +++ 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 4ae4c7fd..73a8c5be 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ tests/test_module_build_service.db-journal .pytest_cache/ requirements.txt.orig mbstest.db +htmlcov/ diff --git a/docker/Dockerfile-tests b/docker/Dockerfile-tests index a9c82ab8..412f0129 100644 --- a/docker/Dockerfile-tests +++ b/docker/Dockerfile-tests @@ -49,7 +49,7 @@ RUN yum -y install \ && yum clean all # We currently require newer versions of these Python packages for the tests. # more-itertools is required by pytest, but versions 6.0.0 and up aren't Python 2 compatible -RUN pip install --upgrade flask-sqlalchemy "pytest<5.0" flake8 tox pip "more-itertools<6.0.0" +RUN pip install --upgrade flask-sqlalchemy "pytest<5.0" flake8 tox pip "more-itertools<6.0.0" pytest-cov VOLUME /src WORKDIR /src ENTRYPOINT ["docker/test.sh"] diff --git a/docker/Dockerfile-tests-py3 b/docker/Dockerfile-tests-py3 index 76c7b72a..610284d8 100644 --- a/docker/Dockerfile-tests-py3 +++ b/docker/Dockerfile-tests-py3 @@ -30,6 +30,7 @@ RUN dnf -y install \ python3-sqlalchemy \ python3-pungi \ python3-psycopg2 \ + python3-pytest-cov \ # Test-only dependencies python3-pytest \ python3-flake8 \ diff --git a/test-requirements.txt b/test-requirements.txt index 799775d5..86b455e7 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,6 +1,7 @@ -r requirements.txt +flake8 mock pytest -flake8 +pytest-cov tox diff --git a/tox.ini b/tox.ini index 03c86a79..fa867b6e 100644 --- a/tox.ini +++ b/tox.ini @@ -54,3 +54,6 @@ deps = bandit commands = /bin/bash -c "bandit -r -ll $(find . -mindepth 1 -maxdepth 1 ! -name tests ! -name \.\* -type d -o -name \*.py)" ignore_outcome = True + +[pytest] +addopts = --cov module_build_service --cov-report html --cov-report term