Skip to content
Permalink
Browse files

Fix expectedFailure in processing tests

  • Loading branch information
m-kuhn committed Mar 4, 2016
1 parent 0395b38 commit 61b8896367f93e5500ee8a5aae05c040a51ce78d
Showing with 20 additions and 16 deletions.
  1. +20 −16 python/plugins/processing/tests/AlgorithmsTestBase.py
@@ -67,19 +67,7 @@ def test_algorithms(self):
algorithm_tests = yaml.load(stream)

for algtest in algorithm_tests['tests']:
expectFailure = False
if 'expectedFailure' in algtest:
exec('\n'.join(algtest['expectedFailure'][:-1]))
expectFailure = eval(algtest['expectedFailure'][-1])
if expectFailure:
try:
yield self.check_algorithm, algtest['name'], algtest
except Exception:
pass
else:
raise _UnexpectedSuccess
else:
yield self.check_algorithm, algtest['name'], algtest
yield self.check_algorithm, algtest['name'], algtest

def check_algorithm(self, name, defs):
"""
@@ -101,9 +89,25 @@ def check_algorithm(self, name, defs):
for r, p in defs['results'].iteritems():
alg.setOutputValue(r, self.load_result_param(p))

print(alg.getAsCommand())
self.assertTrue(AlgorithmExecutor.runalg(alg))
self.check_results(alg.getOutputValuesAsDictionary(), defs['results'])
expectFailure = False
if 'expectedFailure' in defs:
exec('\n'.join(defs['expectedFailure'][:-1])) in globals(), locals()
expectFailure = eval(defs['expectedFailure'][-1])

def doCheck():
print(alg.getAsCommand())
self.assertTrue(AlgorithmExecutor.runalg(alg))
self.check_results(alg.getOutputValuesAsDictionary(), defs['results'])

if expectFailure:
try:
doCheck()
except Exception:
pass
else:
raise _UnexpectedSuccess
else:
doCheck()

def load_params(self, params):
"""

0 comments on commit 61b8896

Please sign in to comment.
You can’t perform that action at this time.