mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-27 00:03:38 -04:00
[processing] Move AlgorithmTests to QgisAlgorithmTests
This commit is contained in:
parent
db60a04ce1
commit
450fb13047
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
test_algorithms.py
|
AlgorithmsTest.py
|
||||||
---------------------
|
---------------------
|
||||||
Date : January 2016
|
Date : January 2016
|
||||||
Copyright : (C) 2016 by Matthias Kuhn
|
Copyright : (C) 2016 by Matthias Kuhn
|
||||||
@ -46,11 +46,6 @@ from qgis.core import (
|
|||||||
QgsMapLayerRegistry
|
QgsMapLayerRegistry
|
||||||
)
|
)
|
||||||
|
|
||||||
from qgis.testing import (
|
|
||||||
start_app,
|
|
||||||
unittest
|
|
||||||
)
|
|
||||||
|
|
||||||
from utilities import (
|
from utilities import (
|
||||||
unitTestDataPath
|
unitTestDataPath
|
||||||
)
|
)
|
||||||
@ -60,25 +55,13 @@ def processingTestDataPath():
|
|||||||
return os.path.join(os.path.dirname(__file__), 'testdata')
|
return os.path.join(os.path.dirname(__file__), 'testdata')
|
||||||
|
|
||||||
|
|
||||||
class TestAlgorithms(unittest.TestCase):
|
class 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_algorithms(self):
|
def test_algorithms(self):
|
||||||
"""
|
"""
|
||||||
This is the main test function. All others will be executed based on the definitions in testdata/algorithm_tests.yaml
|
This is the main test function. All others will be executed based on the definitions in testdata/algorithm_tests.yaml
|
||||||
"""
|
"""
|
||||||
with open(os.path.join(processingTestDataPath(), 'algorithm_tests.yaml'), 'r') as stream:
|
with open(os.path.join(processingTestDataPath(), self.test_definition_file()), 'r') as stream:
|
||||||
algorithm_tests = yaml.load(stream)
|
algorithm_tests = yaml.load(stream)
|
||||||
|
|
||||||
for algtest in algorithm_tests['tests']:
|
for algtest in algorithm_tests['tests']:
|
@ -7,5 +7,5 @@ PLUGIN_INSTALL(processing tests/data ${TEST_DATA_FILES})
|
|||||||
IF(ENABLE_TESTS)
|
IF(ENABLE_TESTS)
|
||||||
INCLUDE(UsePythonTest)
|
INCLUDE(UsePythonTest)
|
||||||
ADD_PYTHON_TEST(ProcessingParametersTest ParametersTest.py)
|
ADD_PYTHON_TEST(ProcessingParametersTest ParametersTest.py)
|
||||||
ADD_PYTHON_TEST(ProcessingAlgorithmsTest AlgorithmsTest.py)
|
ADD_PYTHON_TEST(ProcessingQgisAlgorithmsTest QgisAlgorithmsTest.py)
|
||||||
ENDIF(ENABLE_TESTS)
|
ENDIF(ENABLE_TESTS)
|
||||||
|
58
python/plugins/processing/tests/QgisAlgorithmsTest.py
Normal file
58
python/plugins/processing/tests/QgisAlgorithmsTest.py
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
"""
|
||||||
|
***************************************************************************
|
||||||
|
QgisAlgorithmTests.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 TestQgisAlgorithms(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 'qgis_algorithm_tests.yaml'
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
nose2.main()
|
Loading…
x
Reference in New Issue
Block a user