Skip to content

Commit

Permalink
[processing] Don't use config values for invalid geometry handling in…
Browse files Browse the repository at this point in the history
… tests
  • Loading branch information
nyalldawson committed Apr 26, 2017
1 parent a28bc08 commit 91679b3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions python/plugins/processing/tests/AlgorithmsTestBase.py
Expand Up @@ -61,7 +61,8 @@
from qgis.core import (QgsVectorLayer,
QgsRasterLayer,
QgsProject,
QgsApplication)
QgsApplication,
QgsProcessingContext)

from qgis.testing import _UnexpectedSuccess

Expand Down Expand Up @@ -117,16 +118,20 @@ def check_algorithm(self, name, defs):
exec(('\n'.join(defs['expectedFailure'][:-1])), globals(), locals())
expectFailure = eval(defs['expectedFailure'][-1])

# ignore user setting for invalid geometry handling
context = QgsProcessingContext()
context.setProject(QgsProject.instance())

if expectFailure:
try:
alg.execute()
alg.execute(context)
self.check_results(alg.getOutputValuesAsDictionary(), defs['params'], defs['results'])
except Exception:
pass
else:
raise _UnexpectedSuccess
else:
alg.execute()
alg.execute(context)
self.check_results(alg.getOutputValuesAsDictionary(), defs['params'], defs['results'])

def load_params(self, params):
Expand Down

0 comments on commit 91679b3

Please sign in to comment.