Skip to content

Commit

Permalink
[processing] Better debugging for failed tests
Browse files Browse the repository at this point in the history
(cherry-picked from e83cd61)
  • Loading branch information
nyalldawson committed Apr 10, 2018
1 parent f30c162 commit f71590d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/plugins/processing/tests/AlgorithmsTestBase.py
Expand Up @@ -118,15 +118,15 @@ def check_algorithm(self, name, defs):
if expectFailure:
try:
results, ok = alg.run(parameters, context, feedback)
self.check_results(results, context, defs['params'], defs['results'])
self.check_results(results, context, parameters, defs['results'])
if ok:
raise _UnexpectedSuccess
except Exception:
pass
else:
results, ok = alg.run(parameters, context, feedback)
self.assertTrue(ok, 'params: {}, results: {}'.format(parameters, results))
self.check_results(results, context, defs['params'], defs['results'])
self.check_results(results, context, parameters, defs['results'])

def load_params(self, params):
"""
Expand Down Expand Up @@ -294,6 +294,7 @@ def check_results(self, results, context, params, expected):

elif 'rasterhash' == expected_result['type']:
print("id:{} result:{}".format(id, results[id]))
self.assertTrue(os.path.exists(results[id]), 'File does not exist: {}, {}'.format(results[id], params))
dataset = gdal.Open(results[id], GA_ReadOnly)
dataArray = nan_to_num(dataset.ReadAsArray(0))
strhash = hashlib.sha224(dataArray.data).hexdigest()
Expand Down

0 comments on commit f71590d

Please sign in to comment.