Skip to content

Commit 5d635d1

Browse files
committedAug 5, 2017
Allow list of acceptable raster hashes for processing algorithm tests
Differences in gdal libraries mean the hash value may differ between platforms. Allow multiple acceptable hashes to be listed for expected test results
1 parent 03bae59 commit 5d635d1

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed
 

‎python/plugins/processing/tests/AlgorithmsTestBase.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,10 @@ def check_results(self, results, context, params, expected):
279279
dataArray = nan_to_num(dataset.ReadAsArray(0))
280280
strhash = hashlib.sha224(dataArray.data).hexdigest()
281281

282-
self.assertEqual(strhash, expected_result['hash'])
282+
if not isinstance(expected_result['hash'], str):
283+
self.assertTrue(strhash in expected_result['hash'])
284+
else:
285+
self.assertEqual(strhash, expected_result['hash'])
283286
elif 'file' == expected_result['type']:
284287
expected_filepath = self.filepath_from_param(expected_result)
285288
result_filepath = results[id]

‎python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,9 @@ tests:
11481148
Z_FACTOR: 1.0
11491149
results:
11501150
OUTPUT:
1151-
hash: 762865ee485a6736d188402aa10e6fd38a812a9e45a7dd2d4885a63a
1151+
hash:
1152+
- 762865ee485a6736d188402aa10e6fd38a812a9e45a7dd2d4885a63a
1153+
- f6a8e64647ae93a94f2a4945add8986526a7a07bc85849f3690d15b2
11521154
type: rasterhash
11531155

11541156
- algorithm: qgis:slope
@@ -1160,7 +1162,9 @@ tests:
11601162
Z_FACTOR: 1.0
11611163
results:
11621164
OUTPUT:
1163-
hash: 151ea76a21b286c16567eb6b4b692925a84145b65561a0017effb1a1
1165+
hash:
1166+
- 151ea76a21b286c16567eb6b4b692925a84145b65561a0017effb1a1
1167+
- 177475642c57428b395bc0a1e7e86fc1cfd4d86ffc19f31ff8bc964d
11641168
type: rasterhash
11651169

11661170
- algorithm: qgis:ruggednessindex
@@ -1186,7 +1190,9 @@ tests:
11861190
Z_FACTOR: 1.0
11871191
results:
11881192
OUTPUT:
1189-
hash: 58365b3715b925d6286e7f082ebd9c2a20f09fa1c922176d3f238002
1193+
hash:
1194+
- 58365b3715b925d6286e7f082ebd9c2a20f09fa1c922176d3f238002
1195+
- 75cca4c1a870a1e21185a2d85b33b6d9958a69fc6ebb04e4d6ceb8a3
11901196
type: rasterhash
11911197

11921198
# - algorithm: qgis:relief

0 commit comments

Comments
 (0)