Skip to content

Commit

Permalink
Fix test on newer python
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson authored and github-actions[bot] committed Dec 13, 2024
1 parent 323d53d commit 25f08f2
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 25f08f2

Please sign in to comment.