From 229874ff0b82940463230321ed3e383f94d36ae7 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Fri, 17 Jan 2025 14:23:56 +0100 Subject: [PATCH] tests/conftest.py: Translate pytest exit status to Automake convention Meson and ginsttest-runner expect the Automake convention and will report a failure instead of a skipped test otherwise. Resolves: #1575 --- tests/conftest.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 04afa4b17..1a4e59a11 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -47,6 +47,13 @@ def pytest_configure() -> None: ensure_umockdev_loaded() +def pytest_sessionfinish(session, exitstatus): + # Meson and ginsttest-runner expect tests to exit with status 77 if all + # tests were skipped + if exitstatus == pytest.ExitCode.NO_TESTS_COLLECTED: + session.exitstatus = 77 + + def ensure_environment_set() -> None: env_vars = [ "XDG_DESKTOP_PORTAL_PATH",