diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index dc0bdd7bf5bb2d37fc486b3f627f107e2371c92c..6175ad7c252cca23a4fe68e42f2b3c4bafc4603f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -26,7 +26,8 @@ tests:
         - apt update
         - apt install -y libgl1-mesa-glx xvfb graphviz xdg-utils libcairo2-dev libjpeg-dev libgif-dev
         - pip install tox
-        - xvfb-run tox -e benchmarks,profiling -v --recreate
+        - xvfb-run tox -v -e examples -v --recreate
+        - xvfb-run tox -v -e benchmarks,profiling -v --recreate
         - xvfb-run tox -v --recreate
 
 build_and_deploy_docs:
diff --git a/benchmarks/run_all_examples.py b/benchmarks/run_all_examples.py
new file mode 100644
index 0000000000000000000000000000000000000000..8cc940a3f5526b35519448852a3eab0e7fd85d00
--- /dev/null
+++ b/benchmarks/run_all_examples.py
@@ -0,0 +1,22 @@
+import runpy
+import sys
+from io import StringIO
+
+import importlib_resources
+import pkg_resources
+from importlib_resources import path
+
+from benchmarks.benchmark_utils import swap_attr
+
+for entry in [entry for entry in importlib_resources.contents('examples') if
+              not pkg_resources.resource_isdir('examples', entry)
+              and entry.endswith(".py")
+              and '__init__' not in entry
+              and 'demo.py' not in entry
+              ]:
+    with path('examples', entry) as file_in:
+        print("*****************************************************************")
+        print("Running {}".format(entry))
+        print("*****************************************************************")
+        with swap_attr(sys, "stdin", StringIO("q")):
+            runpy.run_path(file_in, run_name="__main__")
diff --git a/tox.ini b/tox.ini
index 4d214b16a70410f1964e1611640dd26d20b89571..3ff9c893f9e62c7106f49534a6dc0babe96ba0e7 100644
--- a/tox.ini
+++ b/tox.ini
@@ -97,7 +97,7 @@ commands =
 ; run examples from subfolder to ensure that resources are accessed via resources and not via relative paths
     sh -c 'mkdir -p {envtmpdir}/c236d3c240d61a0969d4cb59e2180ce5'
 ; pipe echo into python since some examples expect input to close the window after the example is run
-    sh -c 'cd {envtmpdir}/c236d3c240d61a0969d4cb59e2180ce5 && ls {toxinidir}/examples/*.py | xargs -I{} -n 1 sh -c "echo -e \"\n====== Running {} ========\n\"; echo "q" | python {}"'
+    sh -c 'cd {envtmpdir}/c236d3c240d61a0969d4cb59e2180ce5 &&  python {toxinidir}/benchmarks/run_all_examples.py'
 
 [testenv:notebooks]
 basepython = python