From 7cf7154aeb9d78d2a82a14cf3df1d7d018ed04eb Mon Sep 17 00:00:00 2001 From: cmoineau <cyril.moineau@cea.fr> Date: Thu, 17 Apr 2025 08:56:59 +0000 Subject: [PATCH] Use PyTest instead of xmlrunner to discover Python tests with Ubuntu CI. --- .gitlab/ci/ubuntu_python.gitlab-ci.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.gitlab/ci/ubuntu_python.gitlab-ci.yml b/.gitlab/ci/ubuntu_python.gitlab-ci.yml index 5cdd941..f52c94f 100644 --- a/.gitlab/ci/ubuntu_python.gitlab-ci.yml +++ b/.gitlab/ci/ubuntu_python.gitlab-ci.yml @@ -13,7 +13,7 @@ build:ubuntu_python: before_script: - !reference [.retrieve_deps:apt, script] - DEPENDENCY_JOB="build:ubuntu_python" - - !reference [.ubuntu:download:artifacts, before_script] + - !reference [.ubuntu:download:artifacts, before_script] - python3 -m pip install virtualenv script: @@ -44,7 +44,8 @@ test:ubuntu_python: before_script: - !reference [.retrieve_deps:apt, script] - source venv/bin/activate - - python -m pip install unittest-xml-reporting pytest + # - python -m pip install unittest-xml-reporting pytest + - python -m pip install pytest - which python - python -m pip list - > @@ -53,9 +54,10 @@ test:ubuntu_python: fi script: - cd ${CI_PROJECT_NAME} - # Run on discovery all tests located in project/unit_tests/python and discard the stdout + # Run on discovery all tests located in project/unit_tests/python and discard the stdout # only to show the errors/warnings and the results of the tests - - python -m xmlrunner discover -s unit_tests/ -v -b --output-file xmlrunner-results.xml + # - python -m xmlrunner discover -s unit_tests/ -v -b --output-file xmlrunner-results.xml + - pytest unit_tests/ -v --junitxml=xmlrunner-results.xml artifacts: reports: @@ -71,12 +73,12 @@ coverage:ubuntu_python: tags: - docker - before_script: + before_script: - !reference [.retrieve_deps:apt, script] - source venv/bin/activate - which python - python -m pip list - - python -m pip install numpy coverage requests unittest-xml-reporting + - python -m pip install numpy coverage requests unittest-xml-reporting - > if [[ "$CI_PROJECT_NAME" == "aidge_onnx" ]]; then python -m pip install pytest onnxruntime>=1.18.0 -- GitLab