Commit b92cffe8 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Fixed matplotlib.use() issue.


Former-commit-id: 1c3c893e
parent 8efcf2c7
...@@ -10,13 +10,9 @@ Tests for gms_preprocessing.algorithms.L2B_P.KMeansRSImage ...@@ -10,13 +10,9 @@ Tests for gms_preprocessing.algorithms.L2B_P.KMeansRSImage
import unittest import unittest
import os import os
import matplotlib
import numpy as np import numpy as np
from sklearn.cluster import k_means_ from sklearn.cluster import k_means_
matplotlib.use('Template') # disables matplotlib figure popups
from geoarray import GeoArray # noqa E402 module level import not at top of file from geoarray import GeoArray # noqa E402 module level import not at top of file
from gms_preprocessing import __file__ # noqa E402 module level import not at top of file from gms_preprocessing import __file__ # noqa E402 module level import not at top of file
...@@ -39,6 +35,8 @@ class Test_KMeansRSImage(unittest.TestCase): ...@@ -39,6 +35,8 @@ class Test_KMeansRSImage(unittest.TestCase):
cls.geoArr.to_mem() cls.geoArr.to_mem()
cls.kmeans = KMeansRSImage(cls.geoArr, n_clusters=10) cls.kmeans = KMeansRSImage(cls.geoArr, n_clusters=10)
os.environ['MPLBACKEND'] = 'Template' # disables matplotlib figure popups # NOTE: import geoarray sets 'Agg'
def test_compute_clusters(self): def test_compute_clusters(self):
self.kmeans.compute_clusters() self.kmeans.compute_clusters()
self.assertIsInstance(self.kmeans.clusters, k_means_.KMeans) self.assertIsInstance(self.kmeans.clusters, k_means_.KMeans)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment