Skip to content

Commit

Permalink
[processing] fix GRASS vector tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed May 15, 2018
1 parent cf59968 commit 8aa56fc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/grass7/Grass7Algorithm.py
Expand Up @@ -862,7 +862,7 @@ def exportVectorLayerFromParameter(self, name, parameters, context, layer=None,
if layerType in self.QGIS_OUTPUT_TYPES:
dataType = self.QGIS_OUTPUT_TYPES[layerType]

outFormat = QgsVectorFileWriter.driverForExtension(os.path.splitext(fileName)[1])
outFormat = QgsVectorFileWriter.driverForExtension(os.path.splitext(fileName)[1]).replace(' ', '_')
dsco = self.parameterAsString(parameters, self.GRASS_VECTOR_DSCO, context)
lco = self.parameterAsString(parameters, self.GRASS_VECTOR_LCO, context)
self.exportVectorLayer(grassName, fileName, layer, nocats, dataType, outFormat, dsco, lco)
Expand Down
24 changes: 20 additions & 4 deletions python/plugins/processing/tests/Grass7AlgorithmsVectorTest.py
Expand Up @@ -95,17 +95,25 @@ def testMemoryLayerInput(self):

temp_file = os.path.join(self.temp_dir, 'grass_output.shp')
parameters = {'input': 'testmem',
'cats': '',
'where': '',
'type': [0, 1, 4],
'distance': 1,
'minordistance': None,
'angle': 0,
'column': None,
'scale': 1,
'tolerance': 0.01,
'-s': False,
'-c': False,
'-t': False,
'output': temp_file,
'GRASS_SNAP_TOLERANCE_PARAMETER': -1, 'GRASS_MIN_AREA_PARAMETER': 0.0001,
'GRASS_OUTPUT_TYPE_PARAMETER': 0}
'GRASS_REGION_PARAMETER': None,
'GRASS_SNAP_TOLERANCE_PARAMETER': -1,
'GRASS_MIN_AREA_PARAMETER': 0.0001,
'GRASS_OUTPUT_TYPE_PARAMETER': 0,
'GRASS_VECTOR_DSCO': '',
'GRASS_VECTOR_LCO': ''}
feedback = QgsProcessingFeedback()

results, ok = alg.run(parameters, context, feedback)
Expand Down Expand Up @@ -146,17 +154,25 @@ def testFeatureSourceInput(self):
self.assertIsNotNone(alg)
temp_file = os.path.join(self.temp_dir, 'grass_output_sel.shp')
parameters = {'input': QgsProcessingFeatureSourceDefinition('testmem', True),
'cats': '',
'where': '',
'type': [0, 1, 4],
'distance': 1,
'minordistance': None,
'angle': 0,
'column': None,
'scale': 1,
'tolerance': 0.01,
'-s': False,
'-c': False,
'-t': False,
'output': temp_file,
'GRASS_SNAP_TOLERANCE_PARAMETER': -1, 'GRASS_MIN_AREA_PARAMETER': 0.0001,
'GRASS_OUTPUT_TYPE_PARAMETER': 0}
'GRASS_REGION_PARAMETER': None,
'GRASS_SNAP_TOLERANCE_PARAMETER': -1,
'GRASS_MIN_AREA_PARAMETER': 0.0001,
'GRASS_OUTPUT_TYPE_PARAMETER': 0,
'GRASS_VECTOR_DSCO': '',
'GRASS_VECTOR_LCO': ''}
feedback = QgsProcessingFeedback()

results, ok = alg.run(parameters, context, feedback)
Expand Down

0 comments on commit 8aa56fc

Please sign in to comment.