diff --git a/testing/selftest.py b/testing/selftest.py
index <HASH>..<HASH> 100755
--- a/testing/selftest.py
+++ b/testing/selftest.py
@@ -39,9 +39,9 @@ class TestAbuChart(unittest.TestCase):
     def test_abu_chart(self):
         from NuGridPy import utils,ppn,data_plot
         import matplotlib
+        matplotlib.use('Agg')
         import matplotlib.pylab as mpy
         import os
-        matplotlib.use('Agg')
 
         # Perform tests within temporary directory
         with TemporaryDirectory() as tdir:
@@ -88,9 +88,9 @@ class TestAbuChart(unittest.TestCase):
     def test_abu_evolution(self):
         from NuGridPy import ppn, utils
         import matplotlib
+        matplotlib.use('Agg')
         import matplotlib.pylab as mpy
         import os
-        matplotlib.use('Agg')
 
         # Perform tests within temporary directory
         with TemporaryDirectory() as tdir:
Trying another DISPLAY variable fix