Skip to content

Commit

Permalink
Allow list of acceptable raster hashes for processing algorithm tests
Browse files Browse the repository at this point in the history
Differences in gdal libraries mean the hash value may differ between
platforms. Allow multiple acceptable hashes to be listed for
expected test results
  • Loading branch information
nyalldawson committed Aug 5, 2017
1 parent 03bae59 commit 5d635d1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
5 changes: 4 additions & 1 deletion python/plugins/processing/tests/AlgorithmsTestBase.py
Expand Up @@ -279,7 +279,10 @@ def check_results(self, results, context, params, expected):
dataArray = nan_to_num(dataset.ReadAsArray(0))
strhash = hashlib.sha224(dataArray.data).hexdigest()

self.assertEqual(strhash, expected_result['hash'])
if not isinstance(expected_result['hash'], str):
self.assertTrue(strhash in expected_result['hash'])
else:
self.assertEqual(strhash, expected_result['hash'])
elif 'file' == expected_result['type']:
expected_filepath = self.filepath_from_param(expected_result)
result_filepath = results[id]
Expand Down
Expand Up @@ -1148,7 +1148,9 @@ tests:
Z_FACTOR: 1.0
results:
OUTPUT:
hash: 762865ee485a6736d188402aa10e6fd38a812a9e45a7dd2d4885a63a
hash:
- 762865ee485a6736d188402aa10e6fd38a812a9e45a7dd2d4885a63a
- f6a8e64647ae93a94f2a4945add8986526a7a07bc85849f3690d15b2
type: rasterhash

- algorithm: qgis:slope
Expand All @@ -1160,7 +1162,9 @@ tests:
Z_FACTOR: 1.0
results:
OUTPUT:
hash: 151ea76a21b286c16567eb6b4b692925a84145b65561a0017effb1a1
hash:
- 151ea76a21b286c16567eb6b4b692925a84145b65561a0017effb1a1
- 177475642c57428b395bc0a1e7e86fc1cfd4d86ffc19f31ff8bc964d
type: rasterhash

- algorithm: qgis:ruggednessindex
Expand All @@ -1186,7 +1190,9 @@ tests:
Z_FACTOR: 1.0
results:
OUTPUT:
hash: 58365b3715b925d6286e7f082ebd9c2a20f09fa1c922176d3f238002
hash:
- 58365b3715b925d6286e7f082ebd9c2a20f09fa1c922176d3f238002
- 75cca4c1a870a1e21185a2d85b33b6d9958a69fc6ebb04e4d6ceb8a3
type: rasterhash

# - algorithm: qgis:relief
Expand Down

0 comments on commit 5d635d1

Please sign in to comment.