diff --git a/.gitlab-ci/default.yml b/.gitlab-ci/default.yml
index 4ae49f61a714abd6f867fb297915ad7e6c808dea..a01fd7dc4f29ab8fb4045e8746c6786a3cd3e6d0 100644
--- a/.gitlab-ci/default.yml
+++ b/.gitlab-ci/default.yml
@@ -81,10 +81,12 @@ select tests:
           echo "No reference information given."
           echo "Skipping test selection, build/test stages will consider all tests!"
           touch affectedtests.json
+          touch changedfiles.txt
       fi
   artifacts:
     paths:
       - affectedtests.json
+      - changedfiles.txt
     expire_in: 3 hours
   needs:
     - job: configure
@@ -145,9 +147,21 @@ test python:
   script:
     - source bin/testing/ci-setup-python-env.sh
     - |
-      pushd build-cmake
-        ctest --output-on-failure -L python
-      popd
+      if ([ ! -s changedfiles.txt ] || grep -q python "changedfiles.txt"); then
+        if [ ! -s changedfiles.txt ]; then
+          echo "Skipping test selection: considering all Python tests."
+        else
+          echo "Detected changes in the Python bindings/Python code: considering all Python tests."
+        fi
+        source bin/testing/ci-setup-python-env.sh
+        pushd build-cmake
+          ctest --output-on-failure -L python
+        popd
+      else
+        echo "No changes in the Python bindings/Python code detected: skipping tests."
+      fi
   needs:
     - job: configure
       artifacts: true
+    - job: select tests
+      artifacts: true