From 22a7b3572df1e860344785610287bcdd9dd01dca Mon Sep 17 00:00:00 2001
From: Florent Jaillet <florent.jaillet@lif.univ-mrs.fr>
Date: Tue, 2 May 2017 10:18:06 +0200
Subject: [PATCH] Forcing a non-interactive matplotlib backend in tests to
 solve issue #10

---
 ltfatpy/tests/gabor/test_tfplot.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ltfatpy/tests/gabor/test_tfplot.py b/ltfatpy/tests/gabor/test_tfplot.py
index bb26ca7..6a7b363 100644
--- a/ltfatpy/tests/gabor/test_tfplot.py
+++ b/ltfatpy/tests/gabor/test_tfplot.py
@@ -63,6 +63,7 @@ from __future__ import print_function, division
 import unittest
 import numpy as np
 from numpy.testing import assert_array_equal
+import matplotlib.pyplot as plt
 
 from ltfatpy.gabor.tfplot import tfplot
 
@@ -175,6 +176,11 @@ class TestTfplot(unittest.TestCase):
     def test_plot(self):
         """Check that the all the plotting sections of tfplot can be run
         """
+        # NOTE: To avoid an error when running the tests in a environnement
+        # with no $DISPLAY variable defined, we switch matplotlib to a
+        # non-interactive backend
+        plt.switch_backend("ps")
+        
         coef = np.random.random((5, 4))
         step = 1
         yr = np.array([0., 1.])
-- 
GitLab