mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
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}
23 lines
1.1 KiB
CMake
23 lines
1.1 KiB
CMake
FILE(GLOB PY_FILES *.py)
|
|
FILE(GLOB TEST_DATA_FILES testdata/points.* testdata/table.dbf)
|
|
|
|
PLUGIN_INSTALL(processing tests ${PY_FILES})
|
|
PLUGIN_INSTALL(processing tests/testdata ${TEST_DATA_FILES})
|
|
|
|
IF(ENABLE_TESTS)
|
|
INCLUDE(UsePythonTest)
|
|
ADD_PYTHON_TEST(ProcessingGeneralTest ProcessingGeneralTest.py)
|
|
ADD_PYTHON_TEST(ProcessingGuiTest GuiTest.py)
|
|
ADD_PYTHON_TEST(ProcessingModelerTest ModelerTest.py)
|
|
ADD_PYTHON_TEST(ProcessingProjectProviderTest ProjectProvider.py)
|
|
ADD_PYTHON_TEST(ProcessingToolsTest ToolsTest.py)
|
|
ADD_PYTHON_TEST(ProcessingGenericAlgorithmsTest AlgorithmsTestBase.py)
|
|
ADD_PYTHON_TEST(ProcessingQgisAlgorithmsTest QgisAlgorithmsTest.py)
|
|
ADD_PYTHON_TEST(ProcessingGdalAlgorithmsTest GdalAlgorithmsTest.py)
|
|
ADD_PYTHON_TEST(ProcessingGrass7AlgorithmsImageryTest Grass7AlgorithmsImageryTest.py)
|
|
ADD_PYTHON_TEST(ProcessingGrass7AlgorithmsRasterTest Grass7AlgorithmsRasterTest.py)
|
|
ADD_PYTHON_TEST(ProcessingGrass7AlgorithmsVectorTest Grass7AlgorithmsVectorTest.py)
|
|
ADD_PYTHON_TEST(ProcessingSagaAlgorithmsTest SagaAlgorithmsTest.py)
|
|
ADD_PYTHON_TEST(ProcessingCheckValidityAlgorithmTest CheckValidityAlgorithm.py)
|
|
ENDIF(ENABLE_TESTS)
|