Skip to content
Permalink
Browse files

update Otb Algorithm test to use Map Layer instance

  • Loading branch information
rkanavath authored and nyalldawson committed Feb 22, 2019
1 parent 08b4c1a commit 9983961ee3b5310c602557e8cee5432b05ce6276
Showing with 8 additions and 4 deletions.
  1. +8 −4 python/plugins/processing/tests/OtbAlgorithmsTest.py
@@ -89,17 +89,21 @@ def test_parameterAs_ScriptMode(self):
"""
outdir = tempfile.mkdtemp()
self.cleanup_paths.append(outdir)

context = QgsProcessingContext()
context.setProject(QgsProject.instance())
feedback = QgsProcessingFeedback()

vectorFile = os.path.join(AlgorithmsTestBase.processingTestDataPath(), 'polys.gml')
vectorLayer = QgsProcessingUtils.mapLayerFromString(vectorFile, context)
parameters = {
'in': os.path.join(AlgorithmsTestBase.processingTestDataPath(), 'polys.gml'),
'in': vectorLayer,
'epsg': QgsCoordinateReferenceSystem('EPSG:4326'),
'spx': 1.0,
'spy': 1.0,
'outputpixeltype': 1,
'out': os.path.join(outdir, 'raster.tif')
}
context = QgsProcessingContext()
context.setProject(QgsProject.instance())
feedback = QgsProcessingFeedback()
results = processing.run('otb:Rasterization', parameters, None, feedback)
result_lyr = QgsProcessingUtils.mapLayerFromString(results['out'], context)
self.assertTrue(result_lyr.isValid())

0 comments on commit 9983961

Please sign in to comment.
You can’t perform that action at this time.