Skip to content
Permalink
Browse files

[processing] Add gdal test

  • Loading branch information
m-kuhn committed Feb 5, 2016
1 parent 9111968 commit 781c10ba1c4f9a987774a4fc4d749551ab9b01d1
@@ -116,7 +116,7 @@ def load_param(self, param):
# No type specified, use whatever is there
return param

raise KeyError("Unknown type '{}' specified for parameter '{}'".format(param['type'], param['name']))
raise KeyError("Unknown type '{}' specified for parameter".format(param['type']))

def load_result_param(self, param):
"""
@@ -129,8 +129,14 @@ def load_result_param(self, param):
basename = os.path.basename(param['name'])
filepath = os.path.join(outdir, basename)
return filepath
elif param['type'] == 'rasterhash':
outdir = tempfile.mkdtemp()
self.cleanup_paths.append(outdir)
basename = 'raster.tif'
filepath = os.path.join(outdir, basename)
return filepath

raise KeyError("Unknown type '{}' specified for parameter '{}'".format(param['type'], param['name']))
raise KeyError("Unknown type '{}' specified for parameter".format(param['type']))

def load_layer(self, param):
"""
@@ -8,4 +8,5 @@ IF(ENABLE_TESTS)
INCLUDE(UsePythonTest)
ADD_PYTHON_TEST(ProcessingParametersTest ParametersTest.py)
ADD_PYTHON_TEST(ProcessingQgisAlgorithmsTest QgisAlgorithmsTest.py)
ADD_PYTHON_TEST(ProcessingGdalAlgorithmsTest GdalAlgorithmsTest.py)
ENDIF(ENABLE_TESTS)
@@ -0,0 +1,58 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
GdalAlgorithmTests.py
---------------------
Date : January 2016
Copyright : (C) 2016 by Matthias Kuhn
Email : matthias@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""

__author__ = 'Matthias Kuhn'
__date__ = 'January 2016'
__copyright__ = '(C) 2016, Matthias Kuhn'

# This will get replaced with a git SHA1 when you do a git archive

__revision__ = ':%H$'

import AlgorithmsTestBase

import nose2
import shutil

from qgis.testing import (
start_app,
unittest
)


class TestGdalAlgorithms(unittest.TestCase, AlgorithmsTestBase.AlgorithmsTest):

@classmethod
def setUpClass(cls):
start_app()
from processing.core.Processing import Processing
Processing.initialize()
cls.cleanup_paths = []

@classmethod
def tearDownClass(cls):
for path in cls.cleanup_paths:
shutil.rmtree(path)

def test_definition_file(self):
return 'gdal_algorithm_tests.yaml'


if __name__ == '__main__':
nose2.main()
@@ -0,0 +1,27 @@
# See ../README.md for a description of the file format

tests:
- algorithm: gdalogr:rasterize
name: Test (gdalogr:rasterize)
params:
BIGTIFF: 0
COMPRESS: 4
DIMENSIONS: 0
EXTRA: ""
FIELD: "Bfloatval"
HEIGHT: 100
INPUT:
name: multipolys.gml
type: vector
JPEGCOMPRESSION: 75
NO_DATA: -9999
PREDICTOR: 1
RTYPE: 5
TFW: False
TILED: False
WIDTH: 100
ZLEVEL: 6
results:
OUTPUT:
hash: f1fedeb6782f9389cf43590d4c85ada9155ab61fef6dc285aaeb54d6
type: rasterhash

0 comments on commit 781c10b

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