From ef40de8ad4ce721108d23a25a94f1aa926ecb7b5 Mon Sep 17 00:00:00 2001 From: Marnix Kraus Date: Wed, 24 Jan 2024 15:38:19 +0100 Subject: [PATCH] Install xvfb beforehand --- .github/workflows/qgis.yml | 4 ++++ ribasim_qgis/scripts/run_qgis_tests.py | 26 ++++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/qgis.yml b/.github/workflows/qgis.yml index c66717a37..8715f48b4 100644 --- a/.github/workflows/qgis.yml +++ b/.github/workflows/qgis.yml @@ -22,6 +22,10 @@ jobs: - windows-latest steps: - uses: actions/checkout@v4 + - name: Install xvfb + if: runner.os == 'Linux' + shell: bash + run: sudo apt update && sudo apt install -y xvfb - uses: prefix-dev/setup-pixi@v0.4.1 with: pixi-version: "latest" diff --git a/ribasim_qgis/scripts/run_qgis_tests.py b/ribasim_qgis/scripts/run_qgis_tests.py index c031683e5..749fe46ba 100644 --- a/ribasim_qgis/scripts/run_qgis_tests.py +++ b/ribasim_qgis/scripts/run_qgis_tests.py @@ -1,18 +1,20 @@ import subprocess +import sys + +xvfb = ["xvfb-run", "-a"] if sys.platform == "linux" else [] +qgis_command = [ + "qgis", + "--profiles-path", + ".pixi/qgis_env", + "--version-migration", + "--nologo", + "--code", + "ribasim_qgis/scripts/qgis_testrunner.py", + "ribasim_qgis.tests", +] qgis_process = subprocess.run( - [ - "xvfb-run", - "-a", - "qgis", - "--profiles-path", - ".pixi/qgis_env", - "--version-migration", - "--nologo", - "--code", - "ribasim_qgis/scripts/qgis_testrunner.py", - "ribasim_qgis.tests", - ], + xvfb + qgis_command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True,