Skip to content

Commit

Permalink
Allow expectedFailure in processing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Mar 4, 2016
1 parent 5a18bb6 commit db2ca3a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion python/plugins/processing/tests/AlgorithmsTestBase.py
Expand Up @@ -46,6 +46,8 @@
QgsMapLayerRegistry
)

from qgis.testing import _UnexpectedSuccess

from utilities import (
unitTestDataPath
)
Expand All @@ -65,7 +67,19 @@ def test_algorithms(self):
algorithm_tests = yaml.load(stream)

for algtest in algorithm_tests['tests']:
yield self.check_algorithm, algtest['name'], algtest
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

def check_algorithm(self, name, defs):
"""
Expand Down

0 comments on commit db2ca3a

Please sign in to comment.