Skip to content
Permalink
Browse files

Processing - Tests - Add Ogr2Ogr test with GeoPackage support

  • Loading branch information
rldhont authored and mdouchin committed Oct 23, 2018
1 parent b267182 commit 781d0e11217c7b2874adac8b5d637e76e59b6c7c
Showing with 27 additions and 1 deletion.
  1. +27 −1 python/plugins/processing/tests/GdalAlgorithmsTest.py
@@ -27,15 +27,18 @@

import AlgorithmsTestBase
from processing.algs.gdal.ogr2ogrtopostgis import Ogr2OgrToPostGis
from processing.algs.gdal.ogr2ogr import Ogr2Ogr

import nose2
import shutil

import os
from qgis.testing import (
start_app,
unittest
)

testDataPath = os.path.join(os.path.dirname(__file__), 'testdata')


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

@@ -54,6 +57,29 @@ def tearDownClass(cls):
def test_definition_file(self):
return 'gdal_algorithm_tests.yaml'

def testOgr2Ogr(self):
source = os.path.join(testDataPath, 'polys.gml')

alg = Ogr2Ogr()
alg.setParameterValue('INPUT_LAYER', source)
alg.setParameterValue('FORMAT', 0)
alg.setOutputValue('OUTPUT_LAYER', 'd:/temp/check.shp')
self.assertEqual(
alg.getConsoleCommands(),
['ogr2ogr',
'-f "ESRI Shapefile" "d:/temp/check.shp" ' +
source + ' polys2'])

alg = Ogr2Ogr()
alg.setParameterValue('INPUT_LAYER', source)
alg.setParameterValue('FORMAT', 22)
alg.setOutputValue('OUTPUT_LAYER', 'd:/temp/check.gpkg')
self.assertEqual(
alg.getConsoleCommands(),
['ogr2ogr',
'-f GPKG "d:/temp/check.gpkg" ' +
source + ' polys2'])


class TestGdalOgr2OgrToPostgis(unittest.TestCase):

0 comments on commit 781d0e1

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