From 12e563d789e703012e78d7709b1019c44b23a1ea Mon Sep 17 00:00:00 2001
From: Nico Alt <nicoalt@posteo.org>
Date: Mon, 10 Jun 2019 13:22:28 +0200
Subject: [PATCH] Get test coverage

---
 .gitignore                 | 1 +
 .gitlab-ci.yml             | 1 +
 requirements-dev.txt       | 1 +
 tools/tests/test-pytest.sh | 2 +-
 4 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 412a383..9cb596a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 builddir
+.coverage
 .flatpak-builder
 __pycache__
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a69bd5f..1457617 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -14,6 +14,7 @@ test:pylint:
 
 test:pytest:
     image: debian:stretch
+    coverage: '/TOTAL.*\s+(\d+%)$/'
     script:
         - apt update && apt install --no-install-recommends -y gir1.2-gtk-3.0 python3-gi python3-pip python3-setuptools
         - pip3 install -r requirements-dev.txt
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 6d98279..634cc7d 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -2,4 +2,5 @@
 pycodestyle>=2.5.0
 pylint>=2.3.1
 pytest>=4.6.2
+pytest-cov>=2.7.1
 requests_mock>=1.6.0
diff --git a/tools/tests/test-pytest.sh b/tools/tests/test-pytest.sh
index 274c7b8..2f9a7bf 100755
--- a/tools/tests/test-pytest.sh
+++ b/tools/tests/test-pytest.sh
@@ -1,3 +1,3 @@
 #!/usr/bin/env bash
 
-PYTHONPATH=src pytest tests/
+PYTHONPATH=src pytest --cov=src tests/
-- 
GitLab