diff --git a/.ci/test_template.sh b/.ci/test_template.sh
index 2b95f300ae14b1dd04f40358bd31f3ca23dae730..f8a8fc3d4816361a1151561cc9fefd167c8e59dc 100644
--- a/.ci/test_template.sh
+++ b/.ci/test_template.sh
@@ -24,9 +24,9 @@ TEST_OPTS="--cov-report= --cov-append"
 # We run some tests under xvfb-run
 # because they invoke wx. Sleep in
 # between, otherwise xvfb gets upset.
-xvfb-run -a python setup.py test --addopts="$TEST_OPTS tests/test_idle.py"
+xvfb-run -a pytest --addopts="$TEST_OPTS tests/test_idle.py"
 sleep 5
-xvfb-run -a python setup.py test --addopts="$TEST_OPTS tests/test_platform.py"
+xvfb-run -a pytest --addopts="$TEST_OPTS tests/test_platform.py"
 
 # We run the immv/imcp tests as the nobody
 # user because some tests expect permission
@@ -40,11 +40,11 @@ cmd="$cmd --addopts='$TEST_OPTS tests/test_scripts/test_immv_imcp.py tests/test_
 su -s /bin/bash -c "$cmd" nobody
 
 # 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 --ignore=tests/test_scripts/test_immv_imcp.py"
+pytest --addopts="$TEST_OPTS -m 'not longtest' --ignore=tests/test_idle.py --ignore=tests/test_platform.py --ignore=tests/test_immv_imcp.py --ignore=tests/test_scripts/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'"
+    pytest --addopts="$TEST_OPTS -m 'longtest'"
 fi
 
 python -m coverage report -i
diff --git a/.ci/zenodo_deposit.sh b/.ci/zenodo_deposit.sh
index 32856bb59d850033d4eaa155bec2f6ee61d94862..9c4a0ed7ee85a5355d55b8775f19ae425c7ba93b 100644
--- a/.ci/zenodo_deposit.sh
+++ b/.ci/zenodo_deposit.sh
@@ -9,10 +9,14 @@ zenodo_url=$1
 zenodo_tkn=$2
 zenodo_depid=$3
 
-version=`python setup.py -V`
-upfile=`pwd`/dist/fslpy-"$version".tar.gz
-metafile=`pwd`/.ci/zenodo_meta.json.jinja2
-date=`date +"%Y-%m-%d"`
+version=$(cat fsl/version.py      |
+          egrep '^__version__ +=' |
+          cut -d "=" -f 2         |
+          tr -d "'"               |
+          tr -d ' ')
+upfile=$(pwd)/dist/fslpy-"$version".tar.gz
+metafile=$(pwd)/.ci/zenodo_meta.json.jinja2
+date=$(date +"%Y-%m-%d")
 
 pip install --retries 10 requests jinja2