File tree Expand file tree Collapse file tree 4 files changed +62
-21
lines changed
python/plugins/processing/tests Expand file tree Collapse file tree 4 files changed +62
-21
lines changed Original file line number Diff line number Diff line change 2
2
3
3
"""
4
4
***************************************************************************
5
- test_algorithms .py
5
+ AlgorithmsTest .py
6
6
---------------------
7
7
Date : January 2016
8
8
Copyright : (C) 2016 by Matthias Kuhn
46
46
QgsMapLayerRegistry
47
47
)
48
48
49
- from qgis .testing import (
50
- start_app ,
51
- unittest
52
- )
53
-
54
49
from utilities import (
55
50
unitTestDataPath
56
51
)
@@ -60,25 +55,13 @@ def processingTestDataPath():
60
55
return os .path .join (os .path .dirname (__file__ ), 'testdata' )
61
56
62
57
63
- class TestAlgorithms (unittest .TestCase ):
64
-
65
- @classmethod
66
- def setUpClass (cls ):
67
- start_app ()
68
- from processing .core .Processing import Processing
69
- Processing .initialize ()
70
- cls .cleanup_paths = []
71
-
72
- @classmethod
73
- def tearDownClass (cls ):
74
- for path in cls .cleanup_paths :
75
- shutil .rmtree (path )
58
+ class AlgorithmsTest ():
76
59
77
60
def test_algorithms (self ):
78
61
"""
79
62
This is the main test function. All others will be executed based on the definitions in testdata/algorithm_tests.yaml
80
63
"""
81
- with open (os .path .join (processingTestDataPath (), 'algorithm_tests.yaml' ), 'r' ) as stream :
64
+ with open (os .path .join (processingTestDataPath (), self . test_definition_file () ), 'r' ) as stream :
82
65
algorithm_tests = yaml .load (stream )
83
66
84
67
for algtest in algorithm_tests ['tests' ]:
Original file line number Diff line number Diff line change @@ -7,5 +7,5 @@ PLUGIN_INSTALL(processing tests/data ${TEST_DATA_FILES})
7
7
IF (ENABLE_TESTS )
8
8
INCLUDE (UsePythonTest )
9
9
ADD_PYTHON_TEST (ProcessingParametersTest ParametersTest.py )
10
- ADD_PYTHON_TEST (ProcessingAlgorithmsTest AlgorithmsTest .py )
10
+ ADD_PYTHON_TEST (ProcessingQgisAlgorithmsTest QgisAlgorithmsTest .py )
11
11
ENDIF (ENABLE_TESTS )
Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
2
+
3
+ """
4
+ ***************************************************************************
5
+ QgisAlgorithmTests.py
6
+ ---------------------
7
+ Date : January 2016
8
+ Copyright : (C) 2016 by Matthias Kuhn
9
+ Email : matthias@opengis.ch
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__ = 'Matthias Kuhn'
21
+ __date__ = 'January 2016'
22
+ __copyright__ = '(C) 2016, Matthias Kuhn'
23
+
24
+ # This will get replaced with a git SHA1 when you do a git archive
25
+
26
+ __revision__ = ':%H$'
27
+
28
+ import AlgorithmsTestBase
29
+
30
+ import nose2
31
+ import shutil
32
+
33
+ from qgis .testing import (
34
+ start_app ,
35
+ unittest
36
+ )
37
+
38
+
39
+ class TestQgisAlgorithms (unittest .TestCase , AlgorithmsTestBase .AlgorithmsTest ):
40
+
41
+ @classmethod
42
+ def setUpClass (cls ):
43
+ start_app ()
44
+ from processing .core .Processing import Processing
45
+ Processing .initialize ()
46
+ cls .cleanup_paths = []
47
+
48
+ @classmethod
49
+ def tearDownClass (cls ):
50
+ for path in cls .cleanup_paths :
51
+ shutil .rmtree (path )
52
+
53
+ def test_definition_file (self ):
54
+ return 'qgis_algorithm_tests.yaml'
55
+
56
+
57
+ if __name__ == '__main__' :
58
+ nose2 .main ()
File renamed without changes.
You can’t perform that action at this time.
0 commit comments