Skip to content

Commit 9fe26af

Browse files
committed
Allow processing tests to specify ellipsoid/project CRS
1 parent 1223a1c commit 9fe26af

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

python/plugins/processing/tests/AlgorithmsTestBase.py

+11
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343

4444
from qgis.core import (QgsVectorLayer,
4545
QgsRasterLayer,
46+
QgsCoordinateReferenceSystem,
4647
QgsFeatureRequest,
4748
QgsMapLayer,
4849
QgsProject,
@@ -86,6 +87,16 @@ def check_algorithm(self, name, defs):
8687
self.vector_layer_params = {}
8788
QgsProject.instance().removeAllMapLayers()
8889

90+
if 'project_crs' in defs:
91+
QgsProject.instance().setCrs(QgsCoordinateReferenceSystem(defs['project_crs']))
92+
else:
93+
QgsProject.instance().setCrs(QgsCoordinateReferenceSystem())
94+
95+
if 'ellipsoid' in defs:
96+
QgsProject.instance().setEllipsoid(defs['ellipsoid'])
97+
else:
98+
QgsProject.instance().setEllipsoid('')
99+
89100
params = self.load_params(defs['params'])
90101

91102
print('Running alg: "{}"'.format(defs['algorithm']))

0 commit comments

Comments
 (0)