diff --git a/.ci/test_template.sh b/.ci/test_template.sh
index f0087779365104379fc825fdb2832b6a5dab9f30..4806a7b4c07275558fff23791b21a53414e9fb6d 100644
--- a/.ci/test_template.sh
+++ b/.ci/test_template.sh
@@ -31,6 +31,7 @@ mkdir -p $FSLDIR/data/
 rsync -rv "fsldownload:data/atlases/" "$FSLDIR/data/atlases/"
 
 # Finally, run the damned tests.
+TEST_OPTS="--cov-report= --cov-append"
 
 # We run some tests under xvfb-run
 # because they invoke wx. Sleep in
@@ -48,6 +49,12 @@ xvfb-run python setup.py test --addopts="$TEST_OPTS tests/test_platform.py"
 chmod -R a+w `pwd`
 su -s /bin/bash -c 'source /test.venv/bin/activate && python setup.py test --addopts="$TEST_OPTS tests/test_immv_imcp.py"' nobody
 
-# All other tests can be run as normal
-python setup.py test --addopts="$TEST_OPTS --ignore=tests/test_idle.py --ignore=tests/test_platform.py --ignore=tests/test_immv_imcp.py"
+# All other tests can be run as normal.
+python setup.py test --addopts="$TEST_OPTS -m 'not longtest' --ignore=tests/test_idle.py --ignore=tests/test_platform.py --ignore=tests/test_immv_imcp.py"
+
+# Long tests are only run on release branches
+if [[ $CI_COMMIT_REF_NAME == v* ]]; then
+    python setup.py test --addopts="$TEST_OPTS -m 'longtest'"
+fi
+
 python -m coverage report
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e43678e384e46007095968f5977567b2bc239843..9f88871ee752b0f65297c6119ff6064f6d281c78 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -90,9 +90,8 @@ stages:
 
 
 variables:
-  UPSTREAM_PROJECT:     "fsl/fslpy"
-  UPSTREAM_URL:         "git@git.fmrib.ox.ac.uk"
-  TEST_OPTS:            "--cov-report= --cov-append"
+  UPSTREAM_PROJECT: "fsl/fslpy"
+  UPSTREAM_URL:     "git@git.fmrib.ox.ac.uk"
 
 
 ####################################