Skip to content

Commit

Permalink
update Otb Algorithm test to use Map Layer instance
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashad Kanavath authored and nyalldawson committed Feb 22, 2019
1 parent 08b4c1a commit 9983961
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions python/plugins/processing/tests/OtbAlgorithmsTest.py
Expand Up @@ -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())
Expand Down

0 comments on commit 9983961

Please sign in to comment.