From e33e92b43a822c17b9738b432b782a9f8251a58b Mon Sep 17 00:00:00 2001 From: Richard Date: Tue, 10 Aug 2021 11:09:37 +0100 Subject: [PATCH] Generate and use pytest XML reports This generates XML reports when we run pytest through poe, and uploads them in the relevant CI stage. I've also ignored mypy cache files - I'm not sure why this hasn't been an issue before... --- .gitignore | 4 ++++ .gitlab-ci.yml | 5 +++++ pyproject.toml | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 07112d4a..105b7539 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,9 @@ __pycache__/ *.py[cod] +# Mypy cache +.mypy_cache* + # C extensions *.so @@ -45,6 +48,7 @@ htmlcov/ .cache nosetests.xml coverage.xml +pytest_report.xml # Translations *.mo diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0d84b9a1..4d7e91e0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -102,6 +102,11 @@ pytest: - tags - web + artifacts: + when: always + reports: + junit: pytest_report.xml + openapi: stage: testing image: python:3.7 diff --git a/pyproject.toml b/pyproject.toml index 27543614..d5e21633 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ black_check = "black --check ." isort = "isort openflexure_microscope" pylint = "pylint openflexure_microscope" mypy = "mypy --cobertura-xml-report openflexure_microscope openflexure_microscope" -test = "pytest ." +test = "pytest . --junitxml=pytest_report.xml" serve = "python -m openflexure_microscope.api.app" format = ["black", "isort"]