Skip to content

Commit b421479

Browse files
committed
[processing] infrastructure for SAGA tests
1 parent 8d91f1f commit b421479

File tree

4 files changed

+64
-14
lines changed

4 files changed

+64
-14
lines changed

python/plugins/processing/tests/AlgorithmsTestBase.py

+3-14
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,6 @@
4141
from numpy import nan_to_num
4242
from copy import deepcopy
4343

44-
import processing
45-
46-
from processing.script.ScriptAlgorithm import ScriptAlgorithm # NOQA
47-
48-
from processing.modeler.ModelerAlgorithmProvider import ModelerAlgorithmProvider # NOQA
49-
from processing.algs.qgis.QGISAlgorithmProvider import QGISAlgorithmProvider # NOQA
50-
#from processing.algs.grass7.Grass7AlgorithmProvider import Grass7AlgorithmProvider # NOQA
51-
#from processing.algs.gdal.GdalAlgorithmProvider import GdalAlgorithmProvider # NOQA
52-
#from processing.algs.saga.SagaAlgorithmProvider import SagaAlgorithmProvider # NOQA
53-
from processing.script.ScriptAlgorithmProvider import ScriptAlgorithmProvider # NOQA
54-
#from processing.preconfigured.PreconfiguredAlgorithmProvider import PreconfiguredAlgorithmProvider # NOQA
55-
56-
5744
from qgis.core import (QgsVectorLayer,
5845
QgsRasterLayer,
5946
QgsFeatureRequest,
@@ -65,9 +52,11 @@
6552
QgsProcessingFeedback)
6653

6754
from qgis.testing import _UnexpectedSuccess
68-
6955
from utilities import unitTestDataPath
7056

57+
import processing
58+
from processing.script.ScriptAlgorithm import ScriptAlgorithm # NOQA
59+
7160

7261
def processingTestDataPath():
7362
return os.path.join(os.path.dirname(__file__), 'testdata')

python/plugins/processing/tests/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ IF(ENABLE_TESTS)
1515
ADD_PYTHON_TEST(ProcessingScriptAlgorithmsTest ScriptAlgorithmsTest.py)
1616
ADD_PYTHON_TEST(ProcessingGrass7AlgorithmsImageryTest Grass7AlgorithmsImageryTest.py)
1717
ADD_PYTHON_TEST(ProcessingGrass7AlgorithmsRasterTest Grass7AlgorithmsRasterTest.py)
18+
ADD_PYTHON_TEST(ProcessingSagaAlgorithmsTest SagaAlgorithmsTest.py)
1819
ENDIF(ENABLE_TESTS)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
***************************************************************************
5+
SagaAlgorithmsTests.py
6+
---------------------
7+
Date : September 2017
8+
Copyright : (C) 2017 by Alexander Bruy
9+
Email : alexander dot bruy at gmail dot com
10+
***************************************************************************
11+
* *
12+
* This program is free software; you can redistribute it and/or modify *
13+
* it under the terms of the GNU General Public License as published by *
14+
* the Free Software Foundation; either version 2 of the License, or *
15+
* (at your option) any later version. *
16+
* *
17+
***************************************************************************
18+
"""
19+
20+
__author__ = 'Alexander Bruy'
21+
__date__ = 'September 2017'
22+
__copyright__ = '(C) 2017, Alexander Bruy'
23+
24+
# This will get replaced with a git SHA1 when you do a git archive
25+
26+
__revision__ = ':%H$'
27+
28+
import nose2
29+
import shutil
30+
31+
from qgis.testing import start_app, unittest
32+
import AlgorithmsTestBase
33+
34+
35+
class TestSagaAlgorithms(unittest.TestCase, AlgorithmsTestBase.AlgorithmsTest):
36+
37+
@classmethod
38+
def setUpClass(cls):
39+
start_app()
40+
from processing.core.Processing import Processing
41+
Processing.initialize()
42+
cls.cleanup_paths = []
43+
44+
@classmethod
45+
def tearDownClass(cls):
46+
from processing.core.Processing import Processing
47+
Processing.deinitialize()
48+
for path in cls.cleanup_paths:
49+
shutil.rmtree(path)
50+
51+
def test_definition_file(self):
52+
return 'saga_algorithm_tests.yaml'
53+
54+
55+
if __name__ == '__main__':
56+
nose2.main()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# See ../README.md for a description of the file format
2+
3+
tests:
4+

0 commit comments

Comments
 (0)