diff --git a/.gitignore b/.gitignore index 7de223911ed8ffb38fba5e4d7c1396f3e066eb60..f9dfbf9232e9503f6e751d2b1690613e2a083791 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 00fdb1744da51512586f6bbdeeab5b8d8ddee647..f11019470383ac511b85cffc492125f038990c0d 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 e23f948f9a93d2576d846ef3fede4653f32753a8..f3392583556f8693317188a86e9ab0de5d823269 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 dc7088924ffeddde24a3508bd5ace64095590d33..b84f84e26b71ae21d076a1467dc4589a1ecc6603 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')