From ee4a2b95d8256d3e25a13bdd4747b3bcd79aef46 Mon Sep 17 00:00:00 2001 From: Tanner Prestegard Date: Mon, 26 Aug 2019 10:40:33 -0500 Subject: [PATCH] Add and configure coverage report for tests --- .gitignore | 1 + .gitlab-ci.yml | 2 +- setup.cfg | 8 ++++++++ setup.py | 2 ++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7de2239..f9dfbf9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ MANIFEST build dist install.sh +.coverage .eggs .tox .venv diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 00fdb17..f110194 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -77,7 +77,7 @@ build:debian:stretch: stage: test image: python script: - - python setup.py test + - python setup.py test --addopts "--cov ligo/gracedb" test:python2.7: <<: *test diff --git a/setup.cfg b/setup.cfg index e23f948..f339258 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,6 +7,14 @@ markers = cli: tests related to the command-line interface integration: integration tests, connection to a GraceDB server required +[coverage:run] +omit = + ligo/gracedb/legacy_cli.py + ligo/gracedb/version.py + */test/* + */tests/* + */conftest.py + [flake8] ignore = E129, W503 exclude = diff --git a/setup.py b/setup.py index dc70889..b84f84e 100644 --- a/setup.py +++ b/setup.py @@ -41,6 +41,8 @@ pytest_requirement = 'pytest>=3.1.0' if sys.version_info < (3, 5): pytest_requirement += ',<5.0.0' tests_require.append(pytest_requirement) +tests_require.append('pytest-cov') + # Add mock for Python 2 if sys.version_info.major < 3: tests_require.append('mock>=2.0.0') -- GitLab