From 32ba1cad58c0c9eedef69e31c21b0c8c959243f5 Mon Sep 17 00:00:00 2001
From: "Benjamin Jakimow benjamin.jakimow@geo.hu-berlin.de"
 <benjamin.jakimow@geo.hu-berlin.de>
Date: Wed, 7 Oct 2020 15:05:21 +0200
Subject: [PATCH] EOTimeSeriesViewer: fiext exportMapsToImages() refactored
 module imports smaller fixed cleaned repo from old files

Signed-off-by: Benjamin Jakimow benjamin.jakimow@geo.hu-berlin.de <benjamin.jakimow@geo.hu-berlin.de>
---
 eotimeseriesviewer/main.py             |   2 +
 eotimeseriesviewer/settings.py         |   2 +
 eotimeseriesviewer/stackedbandinput.py |   9 +-
 tests/GLScatterPlotItem.py             | 109 -------------------------
 tests/editmaptool.py                   |  22 -----
 tests/gridwidgets.py                   |  20 -----
 tests/qgis3d.py                        |  14 ----
 tests/test_fileFormatLoading.py        |  29 +++----
 tests/test_labeling.py                 |  52 +++++-------
 tests/test_layerproperties.py          |   9 +-
 tests/test_main.py                     |   7 +-
 tests/test_maptools.py                 |  11 ++-
 tests/test_mapvisualization.py         |  71 ++++++++--------
 tests/test_qgis_environment.py         |  43 ++++------
 tests/test_qgis_interaction.py         |   5 +-
 tests/test_resources.py                |   2 +-
 tests/test_settings.py                 |   8 +-
 tests/test_temporalprofiles.py         |  29 +++----
 tests/test_timeseries.py               |  11 ++-
 tests/test_utils.py                    |  11 +--
 20 files changed, 133 insertions(+), 333 deletions(-)
 delete mode 100644 tests/GLScatterPlotItem.py
 delete mode 100644 tests/editmaptool.py
 delete mode 100644 tests/gridwidgets.py
 delete mode 100644 tests/qgis3d.py

diff --git a/eotimeseriesviewer/main.py b/eotimeseriesviewer/main.py
index fa981154..a25f5890 100644
--- a/eotimeseriesviewer/main.py
+++ b/eotimeseriesviewer/main.py
@@ -857,6 +857,8 @@ class EOTimeSeriesViewer(QgisInterface, QObject):
             assert isinstance(mapCanvas, MapCanvas)
             mapCanvas.timedRefresh()
             tsd = mapCanvas.tsd()
+            if not isinstance(tsd, TimeSeriesDate):
+                continue
             mv = mapCanvas.mapView()
             assert isinstance(mv, MapView)
             mapCanvas.waitWhileRendering()
diff --git a/eotimeseriesviewer/settings.py b/eotimeseriesviewer/settings.py
index 652ad9a4..160e43cb 100644
--- a/eotimeseriesviewer/settings.py
+++ b/eotimeseriesviewer/settings.py
@@ -176,6 +176,8 @@ def value(key: Keys, default=None):
         print(error, file=sys.stderr)
     except Exception as otherError:
         s = ""
+    if value is None:
+        value = default
     return value
 
 
diff --git a/eotimeseriesviewer/stackedbandinput.py b/eotimeseriesviewer/stackedbandinput.py
index acd02883..24748efd 100644
--- a/eotimeseriesviewer/stackedbandinput.py
+++ b/eotimeseriesviewer/stackedbandinput.py
@@ -21,6 +21,7 @@
 """
 import os
 import copy
+import re
 from osgeo import gdal
 import numpy as np
 from collections import OrderedDict
@@ -28,11 +29,11 @@ from xml.etree import ElementTree
 from qgis.PyQt.QtCore import Qt, QModelIndex, QAbstractTableModel, QItemSelectionModel, QTimer
 from qgis.PyQt.QtGui import QColor
 from qgis.PyQt.QtWidgets import QHeaderView, QDialog, QDialogButtonBox, QFileDialog
-from qgis.core import QgsRasterLayer, QgisInterface, QgsProviderRegistry, QgsProject
-from qgis.gui import QgsFileWidget
+from qgis.core import QgsRasterLayer, QgsProviderRegistry, QgsProject
+from qgis.gui import QgsFileWidget, QgisInterface
 import qgis.utils
-from .utils import read_vsimem, loadUi
-from .virtualrasters import VRTRaster, VRTRasterBand, VRTRasterInputSourceBand
+from eotimeseriesviewer.utils import read_vsimem, loadUi
+from eotimeseriesviewer.virtualrasters import VRTRaster, VRTRasterBand, VRTRasterInputSourceBand
 from eotimeseriesviewer import DIR_UI
 from eotimeseriesviewer.dateparser import extractDateTimeGroup
 
diff --git a/tests/GLScatterPlotItem.py b/tests/GLScatterPlotItem.py
deleted file mode 100644
index 2a7759bd..00000000
--- a/tests/GLScatterPlotItem.py
+++ /dev/null
@@ -1,109 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-Demonstrates use of GLScatterPlotItem with rapidly-updating plots.
-
-"""
-
-## Add path to library (just for examples; you do not need this)
-
-import qgis
-from pyqtgraph.Qt import QtCore, QtGui
-import pyqtgraph.opengl as gl
-import numpy as np
-from tests import initQgisApplication
-
-app = initQgisApplication()
-w = gl.GLViewWidget()
-w.opts['distance'] = 20
-w.show()
-w.setWindowTitle('pyqtgraph example: GLScatterPlotItem')
-
-g = gl.GLGridItem()
-w.addItem(g)
-
-
-##
-##  First example is a set of points with pxMode=False
-##  These demonstrate the ability to have points with real size down to a very small scale 
-## 
-pos = np.empty((53, 3))
-size = np.empty((53))
-color = np.empty((53, 4))
-pos[0] = (1,0,0); size[0] = 0.5;   color[0] = (1.0, 0.0, 0.0, 0.5)
-pos[1] = (0,1,0); size[1] = 0.2;   color[1] = (0.0, 0.0, 1.0, 0.5)
-pos[2] = (0,0,1); size[2] = 2./3.; color[2] = (0.0, 1.0, 0.0, 0.5)
-
-z = 0.5
-d = 6.0
-for i in range(3,53):
-    pos[i] = (0,0,z)
-    size[i] = 2./d
-    color[i] = (0.0, 1.0, 0.0, 0.5)
-    z *= 0.5
-    d *= 2.0
-    
-sp1 = gl.GLScatterPlotItem(pos=pos, size=size, color=color, pxMode=False)
-sp1.translate(5,5,0)
-w.addItem(sp1)
-
-
-##
-##  Second example shows a volume of points with rapidly updating color
-##  and pxMode=True
-##
-
-pos = np.random.random(size=(100000,3))
-pos *= [10,-10,10]
-pos[0] = (0,0,0)
-color = np.ones((pos.shape[0], 4))
-d2 = (pos**2).sum(axis=1)**0.5
-size = np.random.random(size=pos.shape[0])*10
-sp2 = gl.GLScatterPlotItem(pos=pos, color=(1,1,1,1), size=size)
-phase = 0.
-
-w.addItem(sp2)
-
-
-##
-##  Third example shows a grid of points with rapidly updating position
-##  and pxMode = False
-##
-
-pos3 = np.zeros((100,100,3))
-pos3[:,:,:2] = np.mgrid[:100, :100].transpose(1,2,0) * [-0.1,0.1]
-pos3 = pos3.reshape(10000,3)
-d3 = (pos3**2).sum(axis=1)**0.5
-
-sp3 = gl.GLScatterPlotItem(pos=pos3, color=(1,1,1,.3), size=0.1, pxMode=False)
-
-w.addItem(sp3)
-
-
-def update():
-    ## update volume colors
-    global phase, sp2, d2
-    s = -np.cos(d2*2+phase)
-    color = np.empty((len(d2),4), dtype=np.float32)
-    color[:,3] = np.clip(s * 0.1, 0, 1)
-    color[:,0] = np.clip(s * 3.0, 0, 1)
-    color[:,1] = np.clip(s * 1.0, 0, 1)
-    color[:,2] = np.clip(s ** 3, 0, 1)
-    sp2.setData(color=color)
-    phase -= 0.1
-    
-    ## update surface positions and colors
-    global sp3, d3, pos3
-    z = -np.cos(d3*2+phase)
-    pos3[:,2] = z
-    color = np.empty((len(d3),4), dtype=np.float32)
-    color[:,3] = 0.3
-    color[:,0] = np.clip(z * 3.0, 0, 1)
-    color[:,1] = np.clip(z * 1.0, 0, 1)
-    color[:,2] = np.clip(z ** 3, 0, 1)
-    sp3.setData(pos=pos3, color=color)
-    
-t = QtCore.QTimer()
-t.timeout.connect(update)
-t.start(50)
-
-app.exec_()
\ No newline at end of file
diff --git a/tests/editmaptool.py b/tests/editmaptool.py
deleted file mode 100644
index 7140ede5..00000000
--- a/tests/editmaptool.py
+++ /dev/null
@@ -1,22 +0,0 @@
-
-from qgis.core import *
-from qgis.gui import *
-from eotimeseriesviewer.tests import start_app, TestObjects
-
-
-app = start_app()
-
-lyr = TestObjects.createRasterLayer()
-QgsProject.instance().addMapLayer(lyr)
-c = QgsMapCanvas()
-c.setLayers([lyr])
-c.setDestinationCrs(lyr.crs())
-c.setExtent(c.fullExtent())
-c.show()
-
-d = QgsAdvancedDigitizingDockWidget(c)
-d.show()
-mapTool = QgsMapToolCapture(c, d, QgsMapToolCapture.CapturePolygon)
-c.setMapTool(mapTool)
-mapTool.activate()
-app.exec_()
\ No newline at end of file
diff --git a/tests/gridwidgets.py b/tests/gridwidgets.py
deleted file mode 100644
index e9279c65..00000000
--- a/tests/gridwidgets.py
+++ /dev/null
@@ -1,20 +0,0 @@
-
-from qgis.gui import *
-from qgis.PyQt.QtCore import *
-from qgis.PyQt.QtGui import *
-from qgis.PyQt.QtWidgets import *
-
-from eotimeseriesviewer.utils import *
-
-viewModes = ['timeXmapview', 'mapviewXtime', 'time2Xmapview']
-class MapViewGridLayout(QGridLayout):
-
-    def __init__(self):
-        pass
-
-    def setViewMode(self, viewMode=str):
-        assert viewMode in viewModes
-
-
-
-
diff --git a/tests/qgis3d.py b/tests/qgis3d.py
deleted file mode 100644
index 7ad1b5d6..00000000
--- a/tests/qgis3d.py
+++ /dev/null
@@ -1,14 +0,0 @@
-
-from eotimeseriesviewer.tests import start_app
-
-app = start_app()
-
-from qgis._3d import *
-
-engine = QgsWindow3DEngine()
-
-w = engine.window()
-w.show()
-
-app.exec_()
-app.quit()
\ No newline at end of file
diff --git a/tests/test_fileFormatLoading.py b/tests/test_fileFormatLoading.py
index 6e2a69d2..876feb6d 100644
--- a/tests/test_fileFormatLoading.py
+++ b/tests/test_fileFormatLoading.py
@@ -1,4 +1,3 @@
-
 import os, re, io, importlib, uuid, unittest
 
 import qgis.testing
@@ -8,13 +7,13 @@ from eotimeseriesviewer import *
 from eotimeseriesviewer.utils import *
 from eotimeseriesviewer.timeseries import *
 
-
 DIR_SENTINEL = r''
 DIR_PLEIADES = r'H:\Pleiades'
 DIR_RAPIDEYE = r'Y:\RapidEye\3A'
 DIR_LANDSAT = jp(DIR_EXAMPLES, 'Images')
 DIR_VRT = r'O:\SenseCarbonProcessing\BJ_NOC\01_RasterData\02_CuttedVRT'
 
+
 class TestFileFormatLoading(EOTSVTestCase):
 
     @classmethod
@@ -54,26 +53,23 @@ class TestFileFormatLoading(EOTSVTestCase):
         self.assertEqual(len(files), len(self.TS))
         s = ""
 
-
     def test_loadOSARIS_GRD(self):
 
         testDir = r'Q:\Processing_BJ\99_OSARIS_Testdata\Loibl-2019-OSARIS-Ala-Archa\Coherences'
         if os.path.isdir(testDir):
             files = file_search(testDir, re.compile(r'.*\.grd$'))
             for i, path in enumerate(files):
-
                 tss = TimeSeriesSource.create(path)
                 self.assertIsInstance(tss, TimeSeriesSource)
                 self.assertTrue(tss.crs().isValid())
                 self.TS.addSources([path], runAsync=False)
-                self.assertEqual(len(self.TS), i+1)
+                self.assertEqual(len(self.TS), i + 1)
 
                 tss = self.TS[0][0]
                 self.assertIsInstance(tss, TimeSeriesSource)
                 sensor = self.TS[0].sensor()
                 self.assertIsInstance(sensor, SensorInstrument)
 
-
     def test_ForceLevel2(self):
 
         path = r'J:\diss_bj\level2\s-america\X0050_Y0025\20140601_LEVEL2_LND08_BOA.tif'
@@ -82,8 +78,9 @@ class TestFileFormatLoading(EOTSVTestCase):
         testData = r'J:\diss_bj\level2\s-america\X0049_Y0025'
         if os.path.isdir(testData):
             files = list(file_search(testData, '*IMP.tif'))
+            if len(files) > 10:
+                files = files[0:10]
             for i, path in enumerate(files):
-
                 self.TS.addSources([path], runAsync=False)
                 self.assertEqual(len(self.TS), i + 1)
 
@@ -102,9 +99,6 @@ class TestFileFormatLoading(EOTSVTestCase):
             tss = TimeSeriesSource.create(p)
             s = ""
 
-
-
-
     def test_nestedVRTs(self):
         # load VRTs pointing to another VRT pointing to Landsat imagery
         searchDir = DIR_VRT
@@ -117,12 +111,14 @@ class TestFileFormatLoading(EOTSVTestCase):
 
     def test_loadRapidEye(self):
         # load RapidEye
-        searchDir =DIR_RAPIDEYE
+        searchDir = DIR_RAPIDEYE
         if not os.path.isdir(searchDir):
             print('DIR_RAPIDEYE undefined. skip test.')
             return
         files = file_search(searchDir, '*.tif', recursive=True)
         files = [f for f in files if not re.search(r'_(udm|browse)\.tif$', f)]
+        if len(files) > 10:
+            files = files[0:10]
         self.TS.addSources(files, runAsync=False)
         self.assertEqual(len(files), len(self.TS.sourceUris()))
 
@@ -133,22 +129,19 @@ class TestFileFormatLoading(EOTSVTestCase):
         tss = tsd[0]
         self.assertIsInstance(tss, TimeSeriesSource)
 
-
-
-
     def test_loadPleiades(self):
-        #load Pleiades data
+        # load Pleiades data
         searchDir = DIR_PLEIADES
         if not os.path.isdir(searchDir):
             print('DIR_PLEIADES undefined. skip test.')
             return
-        #files = file_search(searchDir, 'DIM*.xml', recursive=True)
+        # files = file_search(searchDir, 'DIM*.xml', recursive=True)
         files = list(file_search(searchDir, '*.jp2', recursive=True))[0:3]
         self.TS.addSources(files, runAsync=False)
         self.assertEqual(len(files), len(self.TS))
 
     def test_loadSentinel2(self):
-        #load Sentinel-2
+        # load Sentinel-2
         searchDir = DIR_SENTINEL
         if not os.path.isdir(searchDir):
             print('DIR_SENTINEL undefined. skip test.')
@@ -156,7 +149,7 @@ class TestFileFormatLoading(EOTSVTestCase):
         files = list(file_search(searchDir, '*MSIL1C.xml', recursive=True))
         self.TS.addSources(files, runAsync=False)
 
-        #self.assertRegexpMatches(self.stderr.getvalue().strip(), 'Unable to add:')
+        # self.assertRegexpMatches(self.stderr.getvalue().strip(), 'Unable to add:')
         self.assertEqual(0, len(self.TS))  # do not add a containers
         subdatasets = []
         for file in files:
diff --git a/tests/test_labeling.py b/tests/test_labeling.py
index e4d066af..21393154 100644
--- a/tests/test_labeling.py
+++ b/tests/test_labeling.py
@@ -17,19 +17,18 @@
 ***************************************************************************
 """
 
-from eotimeseriesviewer.tests import start_app, testRasterFiles
 import unittest
-import tempfile
-import os
-import qgis.testing
+
 import xmlrunner
 
 from eotimeseriesviewer.labeling import *
-from eotimeseriesviewer import DIR_REPO
 from eotimeseriesviewer.mapcanvas import MapCanvas
-from eotimeseriesviewer.tests import TestObjects, EOTSVTestCase
 from eotimeseriesviewer.mapvisualization import MapView
-from osgeo import ogr
+from eotimeseriesviewer.tests import TestObjects, EOTSVTestCase
+from qgis.core import QgsVectorLayer, QgsField, QgsEditorWidgetSetup, QgsProject, \
+    QgsFields, QgsEditorWidgetRegistry, QgsEditorWidgetWrapper
+from qgis.gui import QgsDualView, QgsEditorConfigWidget, QgsMapLayerStyleManagerWidget, QgsMapCanvas, QgsGui
+
 
 class TestLabeling(EOTSVTestCase):
 
@@ -37,14 +36,14 @@ class TestLabeling(EOTSVTestCase):
     def setUpClass(cls):
         super().setUpClass()
         print('## setUpClass')
-        #app = qgis.testing.start_app(cleanup=True)
+        # app = qgis.testing.start_app(cleanup=True)
         import eotimeseriesviewer.labeling
         print('## setUpClass - cleanup')
         for store in eotimeseriesviewer.MAP_LAYER_STORES:
             store.removeAllMapLayers()
         print('## setUpClass - done')
 
-    def createVectorLayer(self)->QgsVectorLayer:
+    def createVectorLayer(self) -> QgsVectorLayer:
 
         lyr = TestObjects.createVectorLayer()
         self.assertIsInstance(lyr, QgsVectorLayer)
@@ -83,20 +82,21 @@ class TestLabeling(EOTSVTestCase):
         self.assertIsInstance(lyr, QgsVectorLayer)
 
         tsd = ts[10]
-        #menu = model.menuForTSD(tsd)
-        #self.assertIsInstance(menu, QMenu)
+        # menu = model.menuForTSD(tsd)
+        # self.assertIsInstance(menu, QMenu)
 
         canvas = MapCanvas()
         canvas.setTSD(tsd)
         canvas.setMapView(mv)
-        pos = QPoint(int(canvas.width()*0.5), int(canvas.height()*0.5))
+        pos = QPoint(int(canvas.width() * 0.5), int(canvas.height() * 0.5))
         menu = canvas.contextMenu(pos)
         self.assertIsInstance(menu, QMenu)
 
-        def findLabelAction(menu)->QAction:
+        def findLabelAction(menu) -> QAction:
             for a in menu.actions():
                 if a.text().startswith('Quick Labels'):
                     return a
+
         m = findLabelAction(menu).menu()
 
         self.showGui(menu)
@@ -126,7 +126,6 @@ class TestLabeling(EOTSVTestCase):
             else:
                 self.fail('Unhandled QgsField typeName: {}'.format(field.typeName()))
 
-
     def test_LabelShortcutEditorConfigWidget(self):
         print('## test_LabelShortcutEditorConfigWidget')
         vl = self.createVectorLayer()
@@ -163,8 +162,6 @@ class TestLabeling(EOTSVTestCase):
                 editorWidgetWrapper = reg.create(EDITOR_WIDGET_REGISTRY_KEY, vl, i, setup.config(), None, parent)
                 self.assertIsInstance(editorWidgetWrapper, QgsEditorWidgetWrapper)
 
-
-
         canvas = QgsMapCanvas(parent)
         canvas.setVisible(False)
 
@@ -173,16 +170,13 @@ class TestLabeling(EOTSVTestCase):
         dv.init(vl, canvas)  # , context=self.mAttributeEditorContext)
         dv.setView(QgsDualView.AttributeTable)
 
-
         panel = QgsMapLayerStyleManagerWidget(vl, canvas, parent)
 
         parent.layout().addWidget(w)
         parent.layout().addWidget(dv)
         parent.layout().addWidget(panel)
 
-
-
-        #randomly click into table cells
+        # randomly click into table cells
         vl.startEditing()
 
         size = dv.size()
@@ -190,19 +184,18 @@ class TestLabeling(EOTSVTestCase):
         h = size.height()
         from random import randint
         for i in range(5):
-            print('Test mouse press {}'.format(i+1))
-            x = randint(0, w-1)
-            y = randint(0, h-1)
+            print('Test mouse press {}'.format(i + 1))
+            x = randint(0, w - 1)
+            y = randint(0, h - 1)
             localPos = QPointF(x, y)
             event = QMouseEvent(QEvent.MouseButtonPress, localPos, Qt.LeftButton, Qt.LeftButton, Qt.NoModifier)
             dv.mousePressEvent(event)
 
-
         vl.selectByIds([1, 2, 3])
         ts = TestObjects.createTimeSeries()
         tsd = ts[5]
 
-        if len(quickLabelLayers())> 0:
+        if len(quickLabelLayers()) > 0:
             print('Found QuickLabelLayers:')
             for l in quickLabelLayers():
                 print('{}={}'.format(l.name(), l.source()))
@@ -248,7 +241,8 @@ class TestLabeling(EOTSVTestCase):
                                                      {CONFKEY_LABELTYPE: LabelShortcutType.DecimalYear}))
 
         # set different types of classifications
-        from eotimeseriesviewer.externals.qps.classification.classificationscheme import EDITOR_WIDGET_REGISTRY_KEY as CS_KEY
+        from eotimeseriesviewer.externals.qps.classification.classificationscheme import \
+            EDITOR_WIDGET_REGISTRY_KEY as CS_KEY
         from eotimeseriesviewer.externals.qps.classification.classificationscheme import classSchemeToConfig
         vl.setEditorWidgetSetup(vl.fields().lookupField('class1l'),
                                 QgsEditorWidgetSetup(CS_KEY, classSchemeToConfig(classScheme1)))
@@ -257,11 +251,10 @@ class TestLabeling(EOTSVTestCase):
                                 QgsEditorWidgetSetup(CS_KEY, classSchemeToConfig(classScheme1)))
 
         vl.setEditorWidgetSetup(vl.fields().lookupField('class2l'),
-                                 QgsEditorWidgetSetup(CS_KEY, classSchemeToConfig(classScheme1)))
+                                QgsEditorWidgetSetup(CS_KEY, classSchemeToConfig(classScheme1)))
 
         vl.setEditorWidgetSetup(vl.fields().lookupField('class2n'),
-                                 QgsEditorWidgetSetup(CS_KEY, classSchemeToConfig(classScheme1)))
-
+                                QgsEditorWidgetSetup(CS_KEY, classSchemeToConfig(classScheme1)))
 
         return classScheme1, classScheme2
 
@@ -280,7 +273,6 @@ class TestLabeling(EOTSVTestCase):
 
         self.showGui(canvas)
 
-
     def test_LabelingWidget2(self):
         lyr = TestObjects.createVectorLayer()
         lyr.setName('My Name')
diff --git a/tests/test_layerproperties.py b/tests/test_layerproperties.py
index 8efd2854..20616705 100644
--- a/tests/test_layerproperties.py
+++ b/tests/test_layerproperties.py
@@ -3,21 +3,19 @@ import os
 import sys
 import re
 import xmlrunner
-from qgis.core import *
-from qgis.gui import *
+from qgis.core import QgsVectorLayer
+from qgis.gui import QgsSublayersDialog
 from eotimeseriesviewer.tests import EOTSVTestCase
 import unittest
 
-class TestLayerProperties(EOTSVTestCase):
 
+class TestLayerProperties(EOTSVTestCase):
 
     def test_selectSubLayers(self):
-
         from example import exampleGPKG
         vl = QgsVectorLayer(exampleGPKG)
         from eotimeseriesviewer.externals.qps.layerproperties import subLayerDefinitions
 
-
         sublayerDefs = subLayerDefinitions(vl)
         d = QgsSublayersDialog(QgsSublayersDialog.Ogr, "NAME")
         d.populateLayerTable(sublayerDefs)
@@ -28,4 +26,3 @@ class TestLayerProperties(EOTSVTestCase):
 if __name__ == "__main__":
     unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports'), buffer=False)
     exit(0)
-
diff --git a/tests/test_main.py b/tests/test_main.py
index 821c78ed..bbf831d0 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -148,12 +148,15 @@ class TestMain(EOTSVTestCase):
         d = SaveAllMapsDialog()
         self.assertEqual(d.fileType(), 'PNG')
 
-        pathTestOutput = tempfile.mkdtemp(prefix='EOTSTTestOutput')
+        dirTestOutput = self.createTestOutputDirectory() / 'test_screenshots'
+        os.makedirs(dirTestOutput, exist_ok=True)
+        pathTestOutput = dirTestOutput / 'canvas_shots.png'
 
         TSV = EOTimeSeriesViewer()
 
         paths = TestObjects.createMultiSourceTimeSeries()
-        TSV.addTimeSeriesImages(paths)
+        TSV.addTimeSeriesImages(paths, loadAsync=False)
+        self.assertTrue(len(TSV.timeSeries()) > 0)
         TSV.exportMapsToImages(path=pathTestOutput)
 
         self.showGui(TSV)
diff --git a/tests/test_maptools.py b/tests/test_maptools.py
index fabd6c3a..9b0fda86 100644
--- a/tests/test_maptools.py
+++ b/tests/test_maptools.py
@@ -29,6 +29,7 @@ from eotimeseriesviewer.tests import EOTSVTestCase
 from eotimeseriesviewer.externals.qps.maptools import MapTools, MapToolCenter, \
     FullExtentMapTool, PixelScaleExtentMapTool, QgsMapToolAddFeature, CursorLocationMapTool, QgsMapToolSelect
 
+
 class TestMapTools(EOTSVTestCase):
     """Test that the plugin init is usable for QGIS.
 
@@ -73,8 +74,6 @@ class TestMapTools(EOTSVTestCase):
             self.assertIn(expectation, dict(metadata), message)
 
     def test_TimeSeriesViewer(self):
-
-
         from eotimeseriesviewer.main import EOTimeSeriesViewer
 
         TSV = EOTimeSeriesViewer()
@@ -102,11 +101,11 @@ class TestMapTools(EOTSVTestCase):
         TSV.setMapTool(MapTools.CursorLocation)
         self.assertIsInstance(TSV.mapCanvases()[0].mapTool(), CursorLocationMapTool)
 
-        #TSV.setMapTool(MapTools.SpectralProfile)
-        #self.assertIsInstance(TSV.mapCanvases()[0].mapTool(), SpectralProfileMapTool)
+        # TSV.setMapTool(MapTools.SpectralProfile)
+        # self.assertIsInstance(TSV.mapCanvases()[0].mapTool(), SpectralProfileMapTool)
 
-        #TSV.setMapTool(MapTools.TemporalProfile)
-        #self.assertIsInstance(TSV.mapCanvases()[0].mapTool(), TemporalProfileMapTool)
+        # TSV.setMapTool(MapTools.TemporalProfile)
+        # self.assertIsInstance(TSV.mapCanvases()[0].mapTool(), TemporalProfileMapTool)
 
         TSV.setMapTool(MapTools.MoveToCenter)
         self.assertIsInstance(TSV.mapCanvases()[0].mapTool(), MapToolCenter)
diff --git a/tests/test_mapvisualization.py b/tests/test_mapvisualization.py
index d92b568e..fa3c6d88 100644
--- a/tests/test_mapvisualization.py
+++ b/tests/test_mapvisualization.py
@@ -21,8 +21,13 @@
 from eotimeseriesviewer.tests import createTimeSeries, testRasterFiles, TestObjects, EOTSVTestCase
 from qgis.PyQt.QtGui import *
 from qgis.PyQt.QtCore import *
-from qgis.core import *
-from qgis.gui import *
+from qgis.core import QgsProject, QgsMapLayer, QgsRasterLayer, QgsVectorLayer, \
+    QgsRasterRenderer, QgsFeatureRenderer, \
+    QgsSingleBandGrayRenderer, QgsSingleBandPseudoColorRenderer, QgsMultiBandColorRenderer, \
+    QgsPalettedRasterRenderer, QgsSingleBandColorDataRenderer, QgsHillshadeRenderer, \
+    QgsRasterShader, \
+    QgsVirtualLayerDefinition
+from qgis.gui import QgsFontButton
 import unittest
 import xmlrunner
 from eotimeseriesviewer.utils import *
@@ -31,10 +36,11 @@ from eotimeseriesviewer.mapcanvas import *
 from eotimeseriesviewer.mapvisualization import *
 from example.Images import Img_2014_05_07_LC82270652014127LGN00_BOA
 from eotimeseriesviewer.main import EOTimeSeriesViewer
-#from eotimeseriesviewer import initResources
-#initResources()
 
 
+# from eotimeseriesviewer import initResources
+# initResources()
+
 
 def getChildElements(node):
     assert isinstance(node, QDomNode)
@@ -43,7 +49,6 @@ def getChildElements(node):
 
 
 def compareXML(element1, element2):
-
     assert isinstance(element1, QDomNode)
     assert isinstance(element2, QDomNode)
 
@@ -60,7 +65,6 @@ def compareXML(element1, element2):
 
     if len(elts1) == 0:
 
-
         value1 = element1.nodeValue()
         value2 = element2.nodeValue()
 
@@ -85,29 +89,29 @@ class TestMapVisualization(EOTSVTestCase):
             eotsv.close()
             QApplication.processEvents()
 
-
     def test_FontButton(self):
 
         btn = QgsFontButton()
-        #c = QgsMapCanvas()
-        #c.setCanvasColor(QColor('black'))
-        #c.show()
-        #btn.setMapCanvas(c)
+        # c = QgsMapCanvas()
+        # c.setCanvasColor(QColor('black'))
+        # c.show()
+        # btn.setMapCanvas(c)
         tf = btn.textFormat()
-        #tf.background().setFillColor(QColor('black'))
-        #tf.background().setEnabled(True)
-        tf.previewBackgroundColor = lambda : QColor('black')
+        # tf.background().setFillColor(QColor('black'))
+        # tf.background().setEnabled(True)
+        tf.previewBackgroundColor = lambda: QColor('black')
         btn.setTextFormat(tf)
         btn.show()
         c = QColor('black')
         btn.setStyleSheet('background-color: rgb({}, {}, {});'.format(*c.getRgb()))
-        def onChanged():
 
+        def onChanged():
             tf = btn.textFormat()
 
             font = btn.font()
 
             s = ""
+
         btn.changed.connect(onChanged)
         self.showGui()
 
@@ -148,8 +152,8 @@ class TestMapVisualization(EOTSVTestCase):
 
         btnAMV = QPushButton('Add MapView')
         btnRMV = QPushButton('Remove MapView')
-        btnAMV.clicked.connect(lambda : onNMapViews(len(w.mapViews()) + 1))
-        btnRMV.clicked.connect(lambda : onNMapViews(len(w.mapViews()) - 1))
+        btnAMV.clicked.connect(lambda: onNMapViews(len(w.mapViews()) + 1))
+        btnRMV.clicked.connect(lambda: onNMapViews(len(w.mapViews()) - 1))
 
         sb = QSpinBox()
         sb.setMinimum(1)
@@ -158,27 +162,29 @@ class TestMapVisualization(EOTSVTestCase):
         sb.valueChanged.connect(lambda v: w.setMapsPerMapView(v))
 
         sbX = QSpinBox()
-        sbX.setRange(50,1000)
+        sbX.setRange(50, 1000)
         sbX.setSingleStep(50)
         sbX.setValue(w.mMapSize.width())
         sbY = QSpinBox()
         sbY.setRange(50, 1000)
         sbY.setSingleStep(50)
         sbY.setValue(w.mMapSize.height())
+
         def onMapSizeChanged():
 
             s = QSize(sbX.value(), sbY.value())
             w.setMapSize(s)
+
         sbY.valueChanged.connect(onMapSizeChanged)
         sbX.valueChanged.connect(onMapSizeChanged)
 
         g.addWidget(QLabel('n dates'), 1, 0)
-        g.addWidget(sb, 1,1)
-        g.addWidget(btnAMV,2,0)
-        g.addWidget(btnRMV,2,1)
+        g.addWidget(sb, 1, 1)
+        g.addWidget(btnAMV, 2, 0)
+        g.addWidget(btnRMV, 2, 1)
 
-        g.addWidget(QLabel('Map Size'), 3,0)
-        g.addWidget(sbX, 3,1)
+        g.addWidget(QLabel('Map Size'), 3, 0)
+        g.addWidget(sbX, 3, 1)
         g.addWidget(sbY, 3, 2)
         controllW.show()
 
@@ -195,9 +201,9 @@ class TestMapVisualization(EOTSVTestCase):
             self.assertEqual(w.mGrid.rowCount(), 2)
             w.addMapView(mv3)
             self.assertEqual(w.mGrid.rowCount(), 3)
-        #w.removeMapView(mv2)
-        #self.assertEqual(w.mGrid.rowCount(), 2)
-        #self.assertListEqual(w.mMapViews, [mv1, mv3])
+        # w.removeMapView(mv2)
+        # self.assertEqual(w.mGrid.rowCount(), 2)
+        # self.assertListEqual(w.mMapViews, [mv1, mv3])
 
         for mv in w.mapViews():
             mv.optionShowMapViewName.setChecked(True)
@@ -296,7 +302,7 @@ class TestMapVisualization(EOTSVTestCase):
         self.assertIsInstance(wl, np.ndarray)
         self.assertIsInstance(wlu, str)
         self.assertEqual(wlu, 'μm')
-        refWL = [0.49,  0.56,  0.66,  0.84,  1.65,  2.2]
+        refWL = [0.49, 0.56, 0.66, 0.84, 1.65, 2.2]
 
         self.assertEqual(len(wl), len(refWL))
         for wla, wlb in zip(wl, refWL):
@@ -329,8 +335,6 @@ class TestMapVisualization(EOTSVTestCase):
         r0b = rendererFromXml(xml0)
         self.assertTrue(type(r0), type(r0b))
 
-
-
         self.assertIsInstance(r0, QgsMultiBandColorRenderer)
 
         rasterRenderer = [QgsSingleBandGrayRenderer(r0, 0),
@@ -344,19 +348,15 @@ class TestMapVisualization(EOTSVTestCase):
                           QgsSingleBandColorDataRenderer(r0, 0),
                           ]
 
-
         for r in rasterRenderer:
             r.setInput(lyr.dataProvider())
-        vectorRenderer = []#[QgsSingleSymbolRenderer(QgsLineSymbol()), QgsPointDistanceRenderer()]
-
-
+        vectorRenderer = []  # [QgsSingleSymbolRenderer(QgsLineSymbol()), QgsPointDistanceRenderer()]
 
         for r1 in rasterRenderer + vectorRenderer:
             print('Test {}'.format(r1.__class__.__name__))
             xml1 = rendererToXml(r1)
             self.assertIsInstance(xml1, QDomDocument)
 
-
             r1b = rendererFromXml(xml1)
             self.assertTrue(type(r1), type(r1b))
 
@@ -369,7 +369,6 @@ class TestMapVisualization(EOTSVTestCase):
             self.assertIsInstance(xml2, QDomDocument)
             self.assertTrue(xml1.toString() == xml2.toString())
 
-
             rClone = r1.clone()
             self.assertTrue(type(r1), type(rClone))
             xmlClone = rendererToXml(rClone)
@@ -379,7 +378,6 @@ class TestMapVisualization(EOTSVTestCase):
             self.assertTrue(similar)
             del rClone, xmlClone
 
-
         print('Read style files')
         for path in styleFiles:
             with open(path, encoding='utf8') as f:
@@ -395,4 +393,3 @@ class TestMapVisualization(EOTSVTestCase):
 if __name__ == '__main__':
     unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports'), buffer=False)
     exit(0)
-
diff --git a/tests/test_qgis_environment.py b/tests/test_qgis_environment.py
index 19be8113..3167ec93 100644
--- a/tests/test_qgis_environment.py
+++ b/tests/test_qgis_environment.py
@@ -2,14 +2,16 @@
 
 import os
 import unittest
-from qgis import *
-from qgis.core import *
-from qgis.gui import *
+from qgis.core import \
+    QgsProject, QgsMapLayer, QgsCoordinateReferenceSystem, QgsProviderRegistry, QgsRasterLayer, \
+    QgsLayerTree, QgsLayerTreeModel
+from qgis.gui import \
+    QgsLayerTreeView, QgsMapCanvas, QgsLayerTreeViewDefaultActions, \
+    QgsLayerTreeMapCanvasBridge, QgsLayerTreeViewMenuProvider
 import xmlrunner
 from eotimeseriesviewer.tests import *
 
 
-
 class TestQGISEnvironment(EOTSVTestCase):
     """Test the QGIS Environment"""
 
@@ -17,7 +19,6 @@ class TestQGISEnvironment(EOTSVTestCase):
         pass
 
     def test_mapcanvasbridge(self):
-
         from eotimeseriesviewer.tests import TestObjects
         layer = TestObjects.createVectorLayer()
         layer2 = TestObjects.createVectorLayer()
@@ -45,10 +46,9 @@ class TestQGISEnvironment(EOTSVTestCase):
                        QgsLayerTreeModel.AllowNodeRename |
                        QgsLayerTreeModel.AllowNodeReorder)
 
-
         class MenuProvider(QgsLayerTreeViewMenuProvider):
 
-            def __init__(self, view:QgsLayerTreeView, canvas:QgsMapCanvas):
+            def __init__(self, view: QgsLayerTreeView, canvas: QgsMapCanvas):
                 super(MenuProvider, self).__init__()
                 assert isinstance(view, QgsLayerTreeView)
                 assert isinstance(canvas, QgsMapCanvas)
@@ -60,13 +60,13 @@ class TestQGISEnvironment(EOTSVTestCase):
                 self.actionRename = self.mDefActions.actionRenameGroupOrLayer()
                 self.actionRemove = self.mDefActions.actionRemoveGroupOrLayer()
 
-            def layerTreeView(self)->QgsLayerTreeView:
+            def layerTreeView(self) -> QgsLayerTreeView:
                 return self._view
 
-            def layerTree(self)->QgsLayerTree:
+            def layerTree(self) -> QgsLayerTree:
                 return self.layerTreeModel().rootGroup()
 
-            def layerTreeModel(self)->QgsLayerTreeModel:
+            def layerTreeModel(self) -> QgsLayerTreeModel:
                 return self.layerTreeView().model()
 
             def onAddGroup(self, *args):
@@ -75,8 +75,7 @@ class TestQGISEnvironment(EOTSVTestCase):
                 i = view.currentIndex()
                 view.currentGroupNode().insertGroup(i.row(), 'Group')
 
-            def createContextMenu(self)->QMenu:
-
+            def createContextMenu(self) -> QMenu:
                 model = self.layerTreeModel()
                 ltree = self.layerTree()
                 view = self.layerTreeView()
@@ -85,25 +84,22 @@ class TestQGISEnvironment(EOTSVTestCase):
                 fixedLayers = [l for l in view.selectedLayersRecursive() if l.property('eotsv/fixed')]
                 self.actionRemove.setEnabled(len(fixedLayers) == 0)
 
-                def copyAction(menu:QMenu, action:QAction):
-
+                def copyAction(menu: QMenu, action: QAction):
                     a = menu.addAction(action.text())
                     a.setIcon(action.icon())
                     a.triggered.connect(action.trigger)
 
                 menu = QMenu(view)
-                #copyAction(menu, self.actionAddGroup)
+                # copyAction(menu, self.actionAddGroup)
                 menu.addAction(self.actionAddGroup)
                 menu.addAction(self.actionRename)
-                #copyAction(menu, self.actionRename)
+                # copyAction(menu, self.actionRename)
 
                 menu.addAction(self.actionRemove)
 
-
-
-                #a = menu.addAction('Settings')
-                #from qps.layerproperties import showLayerPropertiesDialog
-                #a.triggered.connect(lambda *args, lyr=l:showLayerPropertiesDialog(lyr, self._canvas))
+                # a = menu.addAction('Settings')
+                # from qps.layerproperties import showLayerPropertiesDialog
+                # a.triggered.connect(lambda *args, lyr=l:showLayerPropertiesDialog(lyr, self._canvas))
 
                 return menu
 
@@ -113,8 +109,6 @@ class TestQGISEnvironment(EOTSVTestCase):
         menuProvider = MenuProvider(v, c)
         v.setMenuProvider(menuProvider)
 
-
-
         ltree.addLayer(layer)
         ltree.addLayer(layer3fix)
         ltree.addLayer(layer2)
@@ -125,7 +119,6 @@ class TestQGISEnvironment(EOTSVTestCase):
         w.layout().addWidget(v)
         w.layout().addWidget(c)
 
-
         self.showGui(w)
 
     def test_qgis_environment(self):
@@ -134,7 +127,7 @@ class TestQGISEnvironment(EOTSVTestCase):
         r = QgsProviderRegistry.instance()
         self.assertIn('gdal', r.providerList())
         self.assertIn('ogr', r.providerList())
-        #self.assertIn('postgres', r.providerList())
+        # self.assertIn('postgres', r.providerList())
 
     def test_projection(self):
         """Test that QGIS properly parses a wkt string.
diff --git a/tests/test_qgis_interaction.py b/tests/test_qgis_interaction.py
index 65c266a1..38ddff5b 100644
--- a/tests/test_qgis_interaction.py
+++ b/tests/test_qgis_interaction.py
@@ -25,8 +25,9 @@ import xmlrunner
 from eotimeseriesviewer.tests import start_app, testRasterFiles, EOTSVTestCase
 from qgis.PyQt.QtGui import *
 from qgis.PyQt.QtCore import *
-from qgis.core import *
-from qgis.gui import *
+from qgis.core import QgsMapLayer, QgsVectorLayer, QgsRasterLayer, QgsRectangle, \
+    QgsCoordinateReferenceSystem, QgsMapToPixel, QgsProject
+from qgis.gui import QgsMapCanvas, QgisInterface
 import unittest
 import tempfile
 
diff --git a/tests/test_resources.py b/tests/test_resources.py
index 10e71642..1564de2f 100644
--- a/tests/test_resources.py
+++ b/tests/test_resources.py
@@ -19,7 +19,7 @@ import xmlrunner
 from qgis import *
 from qgis.PyQt.QtGui import QIcon
 from eotimeseriesviewer import file_search
-from eotimeseriesviewer.tests import start_app, EOTSVTestCase
+from eotimeseriesviewer.tests import EOTSVTestCase
 
 
 class TestResources(EOTSVTestCase):
diff --git a/tests/test_settings.py b/tests/test_settings.py
index 5f3e43bc..200af4f8 100644
--- a/tests/test_settings.py
+++ b/tests/test_settings.py
@@ -25,9 +25,8 @@ import unittest
 import tempfile
 import xmlrunner
 
-from eotimeseriesviewer.mapcanvas import *
-from eotimeseriesviewer import *
-from eotimeseriesviewer.utils import *
+from qgis.core import QgsReadWriteContext, QgsTextFormat
+
 from eotimeseriesviewer.tests import EOTSVTestCase
 
 from eotimeseriesviewer.settings import *
@@ -102,9 +101,6 @@ class TestSettings(EOTSVTestCase):
 
     def test_MapTextFormat(self):
 
-        from qgis.core import QgsTextFormat
-        from qgis.PyQt.QtCore import QSettings
-        from qgis.PyQt.QtXml import QDomDocument
         key = Keys.MapTextFormat
         format0 = defaultValues()[key]
         format1 = defaultValues()[key]
diff --git a/tests/test_temporalprofiles.py b/tests/test_temporalprofiles.py
index 1d711107..cf37e2e8 100644
--- a/tests/test_temporalprofiles.py
+++ b/tests/test_temporalprofiles.py
@@ -17,8 +17,10 @@ import tempfile
 import sys
 import os
 import xmlrunner
-from qgis import *
-from qgis.gui import *
+
+from qgis.core import QgsTask, QgsMapLayer, QgsRasterLayer, QgsProject, \
+    QgsPointXY, QgsGeometry
+from qgis.gui import QgsGui, QgsMapLayerAction, QgsMapLayerActionRegistry
 from qgis.PyQt.QtGui import QIcon
 import example.Images
 from eotimeseriesviewer.timeseries import TimeSeries, TimeSeriesDate
@@ -26,8 +28,6 @@ from eotimeseriesviewer.temporalprofiles import *
 from eotimeseriesviewer.profilevisualization import *
 from eotimeseriesviewer.utils import *
 from eotimeseriesviewer.tests import EOTSVTestCase, TestObjects
-from osgeo import ogr, osr
-
 
 
 class TestTemporalProfiles(EOTSVTestCase):
@@ -75,7 +75,6 @@ class TestTemporalProfiles(EOTSVTestCase):
         tss = timeSeries[0][0]
         self.assertIsInstance(tss, TimeSeriesSource)
 
-
     def test_geometryToPixel(self):
 
         timeSeries = TestObjects.createTimeSeries()
@@ -113,8 +112,8 @@ class TestTemporalProfiles(EOTSVTestCase):
             self.assertEqual(len(px), len(py))
             self.assertEqual(min(px), 0)
             self.assertEqual(min(py), 0)
-            self.assertEqual(max(px), ds.RasterXSize-1)
-            self.assertEqual(max(py), ds.RasterYSize-1)
+            self.assertEqual(max(px), ds.RasterXSize - 1)
+            self.assertEqual(max(py), ds.RasterYSize - 1)
             self.assertEqual(len(px), tss.nl * tss.ns)
 
     def test_createTemporalProfile(self):
@@ -134,7 +133,7 @@ class TestTemporalProfiles(EOTSVTestCase):
         for tp in temporalProfiles:
             tp.loadMissingData()
             nd, nnd, total = tp.loadingStatus()
-            self.assertEqual(total, nd+nnd)
+            self.assertEqual(total, nd + nnd)
 
     def test_temporalProfileLayer(self):
 
@@ -145,8 +144,8 @@ class TestTemporalProfiles(EOTSVTestCase):
         extent = self.TS.maxSpatialExtent()
         center = extent.spatialCenter()
 
-        point1 = SpatialPoint(center.crs(), center.x(), center.y() )
-        point2 = SpatialPoint(center.crs(), center.x()+30, center.y()-30 )
+        point1 = SpatialPoint(center.crs(), center.x(), center.y())
+        point2 = SpatialPoint(center.crs(), center.x() + 30, center.y() - 30)
         tps = lyr1.createTemporalProfiles([point1, point1, point2])
 
         self.assertTrue(len(lyr1) == 3)
@@ -166,6 +165,7 @@ class TestTemporalProfiles(EOTSVTestCase):
             for p in profiles:
                 self.assertIsInstance(p, TemporalProfile)
                 self.assertTrue(p in lyr1)
+
         # load data
         lyr1.sigTemporalProfilesUpdated.connect(onUpdated)
         task = TemporalProfileLoaderTask(lyr1, callback=onLoaded)
@@ -193,9 +193,7 @@ class TestTemporalProfiles(EOTSVTestCase):
                     self.assertIsInstance(x, list)
                     self.assertIsInstance(y, list)
                     self.assertEqual(len(x), len(y))
-                    #self.assertTrue(len(x) > 0)
-
-
+                    # self.assertTrue(len(x) > 0)
 
     def test_plotstyltable(self):
 
@@ -205,7 +203,6 @@ class TestTemporalProfiles(EOTSVTestCase):
         btn.setPlotStyle(style)
         self.showGui(btn)
 
-
     def test_profilesettings(self):
 
         from eotimeseriesviewer.profilevisualization import PlotSettingsTableView
@@ -239,7 +236,6 @@ class TestTemporalProfiles(EOTSVTestCase):
         for a in w.mActionsTP:
             a.trigger()
 
-
         self.showGui(w)
 
     def test_profiledock2(self):
@@ -255,7 +251,7 @@ class TestTemporalProfiles(EOTSVTestCase):
         point3 = SpatialPoint(center.crs(), center.x() + 30, center.y() + 30)
         points = [point1, point2, point3]
         n = len(points)
-        #tps = layer.createTemporalProfiles([point1])
+        # tps = layer.createTemporalProfiles([point1])
         tps = layer.createTemporalProfiles(points)
         self.assertIsInstance(tps, list)
         self.assertEqual(len(tps), n)
@@ -281,4 +277,3 @@ class TestTemporalProfiles(EOTSVTestCase):
 if __name__ == "__main__":
     unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports'), buffer=False)
     exit(0)
-
diff --git a/tests/test_timeseries.py b/tests/test_timeseries.py
index b38be32a..12556cf3 100644
--- a/tests/test_timeseries.py
+++ b/tests/test_timeseries.py
@@ -2,10 +2,13 @@
 """Tests QGIS plugin init."""
 
 import os
+import sys
 import unittest
 import example
 import example.Images
 from osgeo import gdal, ogr, osr
+from qgis.core import QgsRasterLayer, QgsApplication
+from qgis.gui import QgsTaskManagerWidget
 from eotimeseriesviewer.utils import file_search
 from eotimeseriesviewer.tests import TestObjects
 from eotimeseriesviewer.timeseries import *
@@ -74,16 +77,15 @@ class TestTimeSeries(EOTSVTestCase):
         self.assertTrue(len(ts) == len(files))
 
         # save time series, absolute paths
-        pathTSFileAbs = self.createTestOutputDirectory()() / 'timeseries_abs.txt'
+        pathTSFileAbs = self.createTestOutputDirectory() / 'timeseries_abs.txt'
         ts.saveToFile(pathTSFileAbs, relative_path=False)
         self.assertTrue(os.path.isfile(pathTSFileAbs))
 
         # save time series, relative paths
-        pathTSFileRel = self.createTestOutputDirectory()() / 'timeseries_rel.txt'
+        pathTSFileRel = self.createTestOutputDirectory() / 'timeseries_rel.txt'
         ts.saveToFile(pathTSFileRel, relative_path=False)
         self.assertTrue(os.path.isfile(pathTSFileRel))
 
-
         # load time series
         tsAbs = TimeSeries()
         tsAbs.loadFromFile(pathTSFileAbs, runAsync=False)
@@ -350,9 +352,7 @@ class TestTimeSeries(EOTSVTestCase):
         self.assertTrue(len(TS) == 0.5 * len(paths))
         self.assertTrue(len(TS) == 0.5 * len(srcUris))
 
-
     def test_timeseries_loadasync(self):
-
         if os.environ.get('CI'):
             self.skipTest('Test might not terminate in CI setting. Reason unclear.')
 
@@ -360,7 +360,6 @@ class TestTimeSeries(EOTSVTestCase):
 
         w = QgsTaskManagerWidget(QgsApplication.taskManager())
 
-
         TS = TimeSeries()
         TS.addSources(files, nWorkers=1)
 
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 67d16030..9431c3b0 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -14,9 +14,9 @@ __copyright__ = 'Copyright 2017, Benjamin Jakimow'
 
 import unittest
 import xmlrunner
-from qgis import *
-from qgis.core import QgsProject
-from qgis.gui import *
+
+from qgis.core import QgsProject, QgsRectangle, QgsRasterLayer
+from qgis.gui import QgsMapCanvas
 from example.Images import Img_2014_04_21_LC82270652014111LGN00_BOA
 from eotimeseriesviewer.utils import *
 from eotimeseriesviewer.tests import EOTSVTestCase
@@ -40,10 +40,7 @@ class TestUtils(EOTSVTestCase):
         self.assertIsInstance(center, SpatialPoint)
         self.assertEqual(ext.spatialCenter(), center)
 
-
     def test_file_search(self):
-
-
         import example
 
         files = list(file_search(os.path.dirname(example.Images.__file__), '*.123'))
@@ -56,5 +53,3 @@ class TestUtils(EOTSVTestCase):
 if __name__ == "__main__":
     unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports'), buffer=False)
     exit(0)
-
-
-- 
GitLab