2013-08-12 20:44:27 +02:00
|
|
|
FILE(GLOB PY_FILES *.py)
|
2016-11-02 12:53:16 +02:00
|
|
|
FILE(GLOB TEST_DATA_FILES testdata/points.* testdata/table.dbf)
|
2013-08-12 20:44:27 +02:00
|
|
|
|
|
|
|
PLUGIN_INSTALL(processing tests ${PY_FILES})
|
2016-11-02 12:53:16 +02:00
|
|
|
PLUGIN_INSTALL(processing tests/testdata ${TEST_DATA_FILES})
|
2015-11-29 18:42:10 -06:00
|
|
|
|
2016-02-04 02:02:05 +01:00
|
|
|
IF(ENABLE_TESTS)
|
|
|
|
INCLUDE(UsePythonTest)
|
[processing][needs-docs] Add friendlier API for running algorithms as sub-steps
of main algorithm
Using code like:
buffered_layer = processing.run(..., context, feedback)['OUTPUT']
...
return {'OUTPUT': buffered_layer}
can cause issues if done as a sub-step of a larger processing algorithm. This
is because ownership of the generated layer is transferred to the caller
(Python) by processing.run. When the algorithm returns, Processing
attempts to move ownership of the layer from the context to the caller,
resulting in a crash.
(This is by design, because processing.run has been optimised for the
most common use case, which is one-off execution of algorithms as part
of a script, not as part of another processing algorithm. Accordingly
by design it returns layers and ownership to the caller, making things
easier for callers as they do not then have to resolve the layer reference
from the context object and handle ownership themselves)
This commit adds a new "is_child_algorithm" argument to processing.run.
For algorithms which are executed as sub-steps of a larger algorithm
is_child_algorithm should be set to True to avoid any ownership issues
with layers. E.g.
buffered_layer = processing.run(..., context, feedback, is_child_algorithm=True)['OUTPUT']
...
return {'OUTPUT': buffered_layer}
2019-01-29 12:23:31 +10:00
|
|
|
ADD_PYTHON_TEST(ProcessingGeneralTest ProcessingGeneralTest.py)
|
2017-08-05 06:47:22 +10:00
|
|
|
ADD_PYTHON_TEST(ProcessingGuiTest GuiTest.py)
|
2016-11-11 08:35:38 +10:00
|
|
|
ADD_PYTHON_TEST(ProcessingModelerTest ModelerTest.py)
|
2018-07-18 07:18:08 +10:00
|
|
|
ADD_PYTHON_TEST(ProcessingProjectProviderTest ProjectProvider.py)
|
2016-07-13 12:06:41 +10:00
|
|
|
ADD_PYTHON_TEST(ProcessingToolsTest ToolsTest.py)
|
2018-05-05 19:18:41 +10:00
|
|
|
ADD_PYTHON_TEST(ProcessingGenericAlgorithmsTest AlgorithmsTestBase.py)
|
2016-02-05 10:29:13 +01:00
|
|
|
ADD_PYTHON_TEST(ProcessingQgisAlgorithmsTest QgisAlgorithmsTest.py)
|
2019-05-09 09:38:08 +10:00
|
|
|
ADD_PYTHON_TEST(ProcessingQgisAlgorithmsTestPt2 QgisAlgorithmsTest2.py)
|
|
|
|
ADD_PYTHON_TEST(ProcessingQgisAlgorithmsTestPt3 QgisAlgorithmsTest3.py)
|
|
|
|
ADD_PYTHON_TEST(ProcessingQgisAlgorithmsTestPt4 QgisAlgorithmsTest4.py)
|
2019-06-25 09:55:19 +03:00
|
|
|
ADD_PYTHON_TEST(ProcessingGdalAlgorithmsGeneralTest GdalAlgorithmsGeneralTest.py)
|
|
|
|
ADD_PYTHON_TEST(ProcessingGdalAlgorithmsRasterTest GdalAlgorithmsRasterTest.py)
|
|
|
|
ADD_PYTHON_TEST(ProcessingGdalAlgorithmsVectorTest GdalAlgorithmsVectorTest.py)
|
2016-06-11 11:27:23 +02:00
|
|
|
ADD_PYTHON_TEST(ProcessingGrass7AlgorithmsImageryTest Grass7AlgorithmsImageryTest.py)
|
|
|
|
ADD_PYTHON_TEST(ProcessingGrass7AlgorithmsRasterTest Grass7AlgorithmsRasterTest.py)
|
2018-04-08 09:54:18 +10:00
|
|
|
ADD_PYTHON_TEST(ProcessingGrass7AlgorithmsVectorTest Grass7AlgorithmsVectorTest.py)
|
2019-01-08 17:42:00 +01:00
|
|
|
ADD_PYTHON_TEST(ProcessingOtbAlgorithmsTest OtbAlgorithmsTest.py)
|
2017-09-05 10:58:35 +03:00
|
|
|
ADD_PYTHON_TEST(ProcessingSagaAlgorithmsTest SagaAlgorithmsTest.py)
|
2018-09-19 18:29:26 +02:00
|
|
|
ADD_PYTHON_TEST(ProcessingCheckValidityAlgorithmTest CheckValidityAlgorithm.py)
|
2019-02-13 18:52:18 +01:00
|
|
|
ADD_PYTHON_TEST(ProcessingScriptUtilsTest ScriptUtilsTest.py)
|
2016-02-04 02:02:05 +01:00
|
|
|
ENDIF(ENABLE_TESTS)
|