Skip to content

Commit

Permalink
Add pytest testsuite to Gitlab CI
Browse files Browse the repository at this point in the history
Saves the coverage of both testsuites, to allow us to compare them (and make sure the nose-based testsuite hasn't had a regression for some reason)
  • Loading branch information
schroeding committed May 17, 2024
1 parent 22a7998 commit de9f2a1
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,34 @@ stages:
paths:
- coverage.xml

.unit-tests-pytest: &unit-tests-pytest
stage: test
before_script:
# Create user, we do not want to test as root
- adduser --disabled-login --gecos "" $PRIMARY_USER
# Activate coverage for subprocesses
- printf 'import coverage\ncoverage.process_startup()\n' > "/usr/local/lib/python${PYTHON_VERSION}/site-packages/sitecustomize.py"
# Give $PRIMARY_USER permission to create cgroups
- test/for_each_of_my_cgroups.sh chgrp $PRIMARY_USER
- test/for_each_of_my_cgroups.sh chmod g+w $PRIMARY_USER
# Install BenchExec with `dev` dependencies
- sudo -u $PRIMARY_USER pip install --user ".[dev]"
# Start lxcfs
- lxcfs /var/lib/lxcfs &
script:
- sudo -u $PRIMARY_USER
COVERAGE_PROCESS_START=.coveragerc
coverage run -m pytest
after_script:
- sudo -u $PRIMARY_USER coverage combine
- sudo -u $PRIMARY_USER coverage report
- sudo -u $PRIMARY_USER coverage xml -o coverage-pytest.xml
tags:
- privileged
artifacts:
paths:
- coverage-pytest.xml

unit-tests:python-3.7:
<<: *unit-tests
variables:
Expand Down

0 comments on commit de9f2a1

Please sign in to comment.