Skip to content

Commit 24724b9

Browse files
committed
ci: add test coverage to pytest
Signed-off-by: Matej Focko <[email protected]>
1 parent 524d8b0 commit 24724b9

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Makefile

+10-2
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,25 @@ BASE_IMAGE := fedora:latest
22
TEST_TARGET ?= ./tests/
33
PY_PACKAGE := ogr
44
OGR_IMAGE := ogr
5+
COLOR ?= yes
6+
COV_REPORT ?= --cov=ogr --cov-report=term-missing
57

68
build-test-image: recipe.yaml
79
ansible-bender build --build-volumes $(CURDIR):/src:Z -- ./recipe.yaml $(BASE_IMAGE) $(OGR_IMAGE)
810

911
check:
1012
@#`python3 -m pytest` doesn't work here b/c the way requre overrides import system:
1113
@#`AttributeError: module 'importlib_metadata' has no attribute 'distributions'
12-
PYTHONPATH=$(CURDIR) PYTHONDONTWRITEBYTECODE=1 python3 /usr/bin/pytest --verbose --showlocals $(TEST_TARGET)
14+
PYTHONPATH=$(CURDIR) PYTHONDONTWRITEBYTECODE=1 python3 /usr/bin/pytest --color=$(COLOR) --verbose --showlocals $(COV_REPORT) $(TEST_TARGET)
1315

1416
check-in-container:
15-
podman run --rm -it -v $(CURDIR):/src:Z -w /src --env TEST_TARGET $(OGR_IMAGE) make -e GITHUB_TOKEN=$(GITHUB_TOKEN) GITLAB_TOKEN=$(GITLAB_TOKEN) check
17+
podman run --rm -it \
18+
-v $(CURDIR):/src:Z -w /src \
19+
--env TEST_TARGET \
20+
--env COLOR \
21+
--env COV_REPORT \
22+
$(OGR_IMAGE) \
23+
make -e GITHUB_TOKEN=$(GITHUB_TOKEN) GITLAB_TOKEN=$(GITLAB_TOKEN) check
1624

1725
shell:
1826
podman run --rm -ti -v $(CURDIR):/src:Z -w /src $(OGR_IMAGE) bash

files/tasks/generic-dnf-requirements.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- python3-pip
99
- python3-pygithub
1010
- python3-gitlab
11+
- python3-pytest-cov
1112
become: true
1213
- name: Install rpmautospec-rpm-macros
1314
dnf:

0 commit comments

Comments
 (0)