File tree 4 files changed +94
-2
lines changed
python/plugins/processing/tests
4 files changed +94
-2
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ def load_param(self, param):
116
116
# No type specified, use whatever is there
117
117
return param
118
118
119
- raise KeyError ("Unknown type '{}' specified for parameter '{}' " .format (param ['type' ], param [ 'name ' ]))
119
+ raise KeyError ("Unknown type '{}' specified for parameter" .format (param ['type' ]))
120
120
121
121
def load_result_param (self , param ):
122
122
"""
@@ -129,8 +129,14 @@ def load_result_param(self, param):
129
129
basename = os .path .basename (param ['name' ])
130
130
filepath = os .path .join (outdir , basename )
131
131
return filepath
132
+ elif param ['type' ] == 'rasterhash' :
133
+ outdir = tempfile .mkdtemp ()
134
+ self .cleanup_paths .append (outdir )
135
+ basename = 'raster.tif'
136
+ filepath = os .path .join (outdir , basename )
137
+ return filepath
132
138
133
- raise KeyError ("Unknown type '{}' specified for parameter '{}' " .format (param ['type' ], param [ 'name ' ]))
139
+ raise KeyError ("Unknown type '{}' specified for parameter" .format (param ['type' ]))
134
140
135
141
def load_layer (self , param ):
136
142
"""
Original file line number Diff line number Diff line change @@ -8,4 +8,5 @@ IF(ENABLE_TESTS)
8
8
INCLUDE (UsePythonTest)
9
9
ADD_PYTHON_TEST(ProcessingParametersTest ParametersTest.py)
10
10
ADD_PYTHON_TEST(ProcessingQgisAlgorithmsTest QgisAlgorithmsTest.py)
11
+ ADD_PYTHON_TEST(ProcessingGdalAlgorithmsTest GdalAlgorithmsTest.py)
11
12
ENDIF (ENABLE_TESTS)
Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
2
+
3
+ """
4
+ ***************************************************************************
5
+ GdalAlgorithmTests.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 TestGdalAlgorithms (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 'gdal_algorithm_tests.yaml'
55
+
56
+
57
+ if __name__ == '__main__' :
58
+ nose2 .main ()
Original file line number Diff line number Diff line change
1
+ # See ../README.md for a description of the file format
2
+
3
+ tests :
4
+ - algorithm : gdalogr:rasterize
5
+ name : Test (gdalogr:rasterize)
6
+ params :
7
+ BIGTIFF : 0
8
+ COMPRESS : 4
9
+ DIMENSIONS : 0
10
+ EXTRA : " "
11
+ FIELD : " Bfloatval"
12
+ HEIGHT : 100
13
+ INPUT :
14
+ name : multipolys.gml
15
+ type : vector
16
+ JPEGCOMPRESSION : 75
17
+ NO_DATA : -9999
18
+ PREDICTOR : 1
19
+ RTYPE : 5
20
+ TFW : False
21
+ TILED : False
22
+ WIDTH : 100
23
+ ZLEVEL : 6
24
+ results :
25
+ OUTPUT :
26
+ hash : f1fedeb6782f9389cf43590d4c85ada9155ab61fef6dc285aaeb54d6
27
+ type : rasterhash
You can’t perform that action at this time.
0 commit comments