diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 910336ff74c8021b138da2a22cb2eddb582ba924..7213bd9cab5c43f29a61ba594a2ef5026545ea7a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -24,7 +24,7 @@ native_Debian:
     # NOTE: CMake's Ninja generator should not be used with CMake < 3.26 due to internal bugs.
     - time cmake .. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_PREFIX_PATH="$QTCMAKE" $CHECK_FLAGS
     - time make -j16
-    - time xvfb-run -a ctest -j16 --output-on-failure
+    - time ctest -j16 --output-on-failure
     - time make package_source
     - time bash var/mk_wheel_multilinux.sh
     - time cpack -B ./installer .
@@ -162,9 +162,6 @@ windows:
     - $QTCMake_DIR = "$QT_MSVC_DIR/lib/cmake"
     - $PY_PLATFORM_DIR = "C:/Users/admin/.pyenv/pyenv-win/versions/3.11.5/"
     - $BUILD_DIR = "build"
-    # change the system PATH temporarily (needed for tests)
-    - $env:PYTHONPATH += "$CI_PROJECT_DIR/build/lib"
-    - $env:PATH = "$QT_MSVC_DIR/bin;$env:PATH"
     # list powershell properties
     - echo "# Path '<$Env:Path>'"
     - echo "# PythonPath '<$Env:PYTHONPATH>'"
@@ -190,7 +187,10 @@ windows:
     - pwd
     - if($CI_PIPELINE_SOURCE -eq "schedule") { cmake --build . --target clean; echo "redundant target purge done" }
     - cmake --build . -j20 --config Release
-    - ctest -C Release --parallel 20 --output-on-failure
+    - |
+      $env:PYTHONPATH += "$CI_PROJECT_DIR/build/lib";
+      $env:PATH = "$QT_MSVC_DIR/bin;$env:PATH";
+      ctest -C Release --parallel 20 --output-on-failure
     - cpack -C Release -B ./installer .
   artifacts:
     paths: