Skip to content

Commit db2ca3a

Browse files
committedMar 4, 2016
Allow expectedFailure in processing tests
1 parent 5a18bb6 commit db2ca3a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed
 

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
QgsMapLayerRegistry
4747
)
4848

49+
from qgis.testing import _UnexpectedSuccess
50+
4951
from utilities import (
5052
unitTestDataPath
5153
)
@@ -65,7 +67,19 @@ def test_algorithms(self):
6567
algorithm_tests = yaml.load(stream)
6668

6769
for algtest in algorithm_tests['tests']:
68-
yield self.check_algorithm, algtest['name'], algtest
70+
expectFailure = False
71+
if 'expectedFailure' in algtest:
72+
exec('\n'.join(algtest['expectedFailure'][:-1]))
73+
expectFailure = eval(algtest['expectedFailure'][-1])
74+
if expectFailure:
75+
try:
76+
yield self.check_algorithm, algtest['name'], algtest
77+
except Exception:
78+
pass
79+
else:
80+
raise _UnexpectedSuccess
81+
else:
82+
yield self.check_algorithm, algtest['name'], algtest
6983

7084
def check_algorithm(self, name, defs):
7185
"""

0 commit comments

Comments
 (0)
Please sign in to comment.