diff --git a/tests/test_fslsub.py b/tests/test_fslsub.py
index 40d7668285c813b332c8da91574cc34ffa671681..d7c6460cafe5428d36833a953befe27207a4c626 100644
--- a/tests/test_fslsub.py
+++ b/tests/test_fslsub.py
@@ -22,7 +22,7 @@ from . import mockFSLDIR
 
 
 mock_fsl_sub = """
-#!{}
+#!/usr/bin/env python3
 
 import random
 import os
@@ -62,8 +62,7 @@ with open('{{}}.o{{}}'.format(cmd, jobid), 'w') as stdout, \
 
 print(str(jobid))
 sys.exit(0)
-""".format(sys.executable, op.dirname(fsl.__file__)).strip()
-
+""".format(op.dirname(fsl.__file__)).strip()
 
 @contextlib.contextmanager
 def fslsub_mockFSLDIR():
diff --git a/tests/test_wrappers/test_fslstats.py b/tests/test_wrappers/test_fslstats.py
index 8d20b4accaf7416a42d02c136d43129028f06fde..a38bf86d5b8eb42f746fec669315e57bba2488b6 100644
--- a/tests/test_wrappers/test_fslstats.py
+++ b/tests/test_wrappers/test_fslstats.py
@@ -18,9 +18,9 @@ from .. import mockFSLDIR as mockFSLDIR_base, make_random_image
 
 
 mock_fslstats = """
-#!{}
+#!/usr/bin/env python3
 
-shape = {{outshape}}
+shape = {outshape}
 
 import sys
 import numpy as np
@@ -31,7 +31,7 @@ if len(shape) == 1:
     data = data.reshape(1, -1)
 
 np.savetxt(sys.stdout, data, fmt='%i')
-""".format(sys.executable).strip()
+""".strip()
 
 
 @contextlib.contextmanager