From 0413cf7b9eb42a8ec76bfa20f293afd7a06a1fe5 Mon Sep 17 00:00:00 2001 From: Bastien Abadie <abadie@teklia.com> Date: Tue, 3 Oct 2023 14:57:16 +0000 Subject: [PATCH] Add unit test coverage --- .gitignore | 1 + .gitlab-ci.yml | 7 +++++-- tests/__init__.py | 0 tox.ini | 9 ++++++++- 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 tests/__init__.py diff --git a/.gitignore b/.gitignore index 142d9be..4baa4ea 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ *.egg-info/ __pycache__ .tox +.coverage diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d0d3528..bbfc4ff 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,7 +10,7 @@ cache: linter: stage: test - image: python:3 + image: python:3.10 cache: paths: @@ -31,7 +31,7 @@ linter: tests: stage: test - image: python:3 + image: python:3.10 cache: paths: @@ -43,6 +43,9 @@ tests: script: - tox + # Process coverage report so that it shows up in Gitlab interface + coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/' + bump-python-deps: stage: release image: registry.gitlab.teklia.com/infra/devops:latest diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tox.ini b/tox.ini index a8d512b..0594b2d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,18 @@ [tox] envlist = nerval +[tool:pytest] +testpaths = tests +addopts = + --cov-report=term-missing + + [testenv] commands = - pytest {posargs} + pytest --cov=nerval {posargs} deps = pytest pytest-lazy-fixture + pytest-cov -rrequirements.txt -- GitLab