Skip to content

Commit 9983961

Browse files
Rashad Kanavathnyalldawson
Rashad Kanavath
authored andcommitted
update Otb Algorithm test to use Map Layer instance
1 parent 08b4c1a commit 9983961

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

python/plugins/processing/tests/OtbAlgorithmsTest.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,21 @@ def test_parameterAs_ScriptMode(self):
8989
"""
9090
outdir = tempfile.mkdtemp()
9191
self.cleanup_paths.append(outdir)
92+
93+
context = QgsProcessingContext()
94+
context.setProject(QgsProject.instance())
95+
feedback = QgsProcessingFeedback()
96+
97+
vectorFile = os.path.join(AlgorithmsTestBase.processingTestDataPath(), 'polys.gml')
98+
vectorLayer = QgsProcessingUtils.mapLayerFromString(vectorFile, context)
9299
parameters = {
93-
'in': os.path.join(AlgorithmsTestBase.processingTestDataPath(), 'polys.gml'),
100+
'in': vectorLayer,
94101
'epsg': QgsCoordinateReferenceSystem('EPSG:4326'),
95102
'spx': 1.0,
96103
'spy': 1.0,
97104
'outputpixeltype': 1,
98105
'out': os.path.join(outdir, 'raster.tif')
99106
}
100-
context = QgsProcessingContext()
101-
context.setProject(QgsProject.instance())
102-
feedback = QgsProcessingFeedback()
103107
results = processing.run('otb:Rasterization', parameters, None, feedback)
104108
result_lyr = QgsProcessingUtils.mapLayerFromString(results['out'], context)
105109
self.assertTrue(result_lyr.isValid())

0 commit comments

Comments
 (0)