From 3ea7e98a483b4f45825bf3b3818f0d9b5acccba2 Mon Sep 17 00:00:00 2001 From: InsanePrawn Date: Sun, 11 Sep 2022 01:32:59 +0200 Subject: [PATCH] pytest: move coverage flags from .gitlab-ci.yml to pytest.sh, add test_requirements.txt for pip --- .gitlab-ci.yml | 5 +++-- pytest.sh | 2 +- test_requirements.txt | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 test_requirements.txt diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 36d16f8..8ec6cb1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,12 +27,12 @@ pytest: image: archlinux before_script: - pacman -Sy --noconfirm --needed archlinux-keyring && pacman -Su --noconfirm python python-pip sudo git base-devel - - pip install pytest pytest-cov -r requirements.txt + - pip install -r test_requirements.txt -r requirements.txt - 'echo "kupfer ALL = (ALL) NOPASSWD: ALL" > /etc/sudoers.d/kupfer_all' - useradd -m kupfer - chmod 777 . script: - - script -e -c 'su kupfer -s /bin/bash -c "./pytest.sh --cov=. --cov-branch --cov-report=term --cov-report=xml:coverage.xml"' + - script -e -c 'su kupfer -s /bin/bash -c "./pytest.sh --junit-xml=pytest-report.xml --cov-report=xml:coverage.xml"' coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/' artifacts: reports: @@ -40,6 +40,7 @@ pytest: coverage_report: coverage_format: cobertura path: coverage.xml + build_docker: stage: build image: docker:latest diff --git a/pytest.sh b/pytest.sh index 99ad17c..d305774 100755 --- a/pytest.sh +++ b/pytest.sh @@ -1,4 +1,4 @@ #!/bin/bash sudo -v -python -m pytest --junit-xml=pytest-report.xml -v "$@" ./*/test_*.py +python -m pytest -v --cov=. --cov-branch --cov-report=term "$@" ./*/test_*.py diff --git a/test_requirements.txt b/test_requirements.txt new file mode 100644 index 0000000..9955dec --- /dev/null +++ b/test_requirements.txt @@ -0,0 +1,2 @@ +pytest +pytest-cov