Skip to content

Commit

Permalink
Merge pull request #59878 from qgis/backport-59868-to-release-3_40
Browse files Browse the repository at this point in the history
[Backport release-3_40] Fix test on newer python
  • Loading branch information
alexbruy authored Dec 16, 2024
2 parents e3ac9f6 + 25f08f2 commit b068ecf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions python/plugins/processing/tests/QgisAlgorithmsTest1.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,16 @@ def testParameterPythonImport(self):
for t in QgsApplication.processingRegistry().parameterTypes():
import_string = t.pythonImportString()
# check that pythonImportString correctly imports
exec(import_string)
# and now we should be able to instantiate an object!
# and that we can instantiate an object!
if t.className() == "QgsProcessingParameterProviderConnection":
exec(
f"test = {t.className()}('id','name', 'provider')\nself.assertIsNotNone(test)"
f"{import_string}\ntest = {t.className()}('id','name', 'provider')\nassert test is not None",
{},
)
else:
exec(f"test = {t.className()}('id','name')\nself.assertIsNotNone(test)")
exec(
f"{import_string}\ntest = {t.className()}('id','name')\nassert test is not None"
), {}


if __name__ == "__main__":
Expand Down

0 comments on commit b068ecf

Please sign in to comment.