From f52ac2727d40ede9a6a42e7425b9287eb0a475d4 Mon Sep 17 00:00:00 2001 From: "Julien M." Date: Fri, 29 Dec 2023 17:22:25 +0100 Subject: [PATCH 1/2] tests: add more fixtures scenarios --- .../scenarios/good_scenario_sample.qdt.yml | 14 +--- .../good_scenario_splash_screen_remove.yml | 58 +++++++++++++ .../good_scenario_with_unexisting_jobs.yml | 83 +++++++++++++++++++ 3 files changed, 142 insertions(+), 13 deletions(-) create mode 100644 tests/fixtures/scenarios/good_scenario_splash_screen_remove.yml create mode 100644 tests/fixtures/scenarios/good_scenario_with_unexisting_jobs.yml diff --git a/tests/fixtures/scenarios/good_scenario_sample.qdt.yml b/tests/fixtures/scenarios/good_scenario_sample.qdt.yml index 65f255de..04a1feb9 100644 --- a/tests/fixtures/scenarios/good_scenario_sample.qdt.yml +++ b/tests/fixtures/scenarios/good_scenario_sample.qdt.yml @@ -10,7 +10,7 @@ metadata: settings: DEBUG: false - LOCAL_WORK_DIR: ~/.cache/qgis-deployment-toolbelt/Oslandia/ + LOCAL_WORK_DIR: ~/.cache/qgis-deployment-toolbelt/tests/ QGIS_EXE_PATH: linux: /usr/bin/qgis mac: /usr/bin/qgis @@ -69,15 +69,3 @@ steps: with: action: create_or_restore strict: false - - - name: Create report - uses: telemetry-manager - with: - action: send - module: sentry - - - name: Send log - uses: telemetry-manager - with: - action: send - module: sentry diff --git a/tests/fixtures/scenarios/good_scenario_splash_screen_remove.yml b/tests/fixtures/scenarios/good_scenario_splash_screen_remove.yml new file mode 100644 index 00000000..60e174e6 --- /dev/null +++ b/tests/fixtures/scenarios/good_scenario_splash_screen_remove.yml @@ -0,0 +1,58 @@ +# This is a sample of a YAML file for the QGIS Deployment Toolbelt scenario. +# For now, it's more a roadmap than a real description of what it's implemented. + +metadata: + title: "Test scenario removing splash screens" + id: sample-scenario-good-splash-removal + description: >- + Test scenario with splash screen removing + +settings: + DEBUG: false + LOCAL_WORK_DIR: ~/.cache/qgis-deployment-toolbelt/tests/ + QGIS_EXE_PATH: + linux: /usr/bin/qgis + mac: /usr/bin/qgis + windows: "%PROGRAMFILES%/QGIS/3_22/bin/qgis-bin.exe" + SCENARIO_VALIDATION: true + +steps: + - name: Synchronize QGIS profiles from remote location + uses: qprofiles-manager + with: + action: download + source: https://gitlab.com/charente-eaux/ocarhy/profils-qgis.git + protocol: git + branch: main + + - name: Download plugins + uses: qplugins-downloader + with: + force: false + threads: 5 + + - name: Synchronize plugins + uses: qplugins-synchronizer + with: + action: create_or_restore + profile_ref: downloaded + source: ~/.cache/qgis-deployment-toolbelt/plugins + + - name: Create shortcuts for profiles + uses: shortcuts-manager + with: + action: create_or_restore + include: + - profile: oslandia + label: "QGIS - Profil Oslandia" + additional_arguments: "--noversioncheck" + desktop: true + start_menu: true + icon: "qgis_icon_oslandia.ico" + qgis_path: "%PROGRAMFILES%\\QGIS\\3_22\\bin\\qgis-bin.exe" + + - name: Set splash screen + uses: splash-screen-manager + with: + action: remove + strict: false diff --git a/tests/fixtures/scenarios/good_scenario_with_unexisting_jobs.yml b/tests/fixtures/scenarios/good_scenario_with_unexisting_jobs.yml new file mode 100644 index 00000000..143bd32a --- /dev/null +++ b/tests/fixtures/scenarios/good_scenario_with_unexisting_jobs.yml @@ -0,0 +1,83 @@ +# This is a sample of a YAML file for the QGIS Deployment Toolbelt scenario. +# For now, it's more a roadmap than a real description of what it's implemented. + +metadata: + title: "Sample scenario of QGIS Deployment Toolbelt" + id: sample-scenario-good + description: >- + This is an example a scenario YAML file for the QGIS Deployment Toolbelt to + demonstrate capabilities. + +settings: + DEBUG: false + LOCAL_WORK_DIR: ~/.cache/qgis-deployment-toolbelt/tests/ + QGIS_EXE_PATH: + linux: /usr/bin/qgis + mac: /usr/bin/qgis + windows: "%PROGRAMFILES%/QGIS/3_22/bin/qgis-bin.exe" + SCENARIO_VALIDATION: true + +steps: + - name: Set environment variables + uses: manage-env-vars + with: + - name: PYQGIS_STARTUP + action: "add" + value: "~/scripts/qgis_startup.py" + scope: "user" + - name: QDT_TEST_FAKE_ENV_VAR_BOOL + action: "add" + value: true + scope: "user" + + - name: Synchronize QGIS profiles from remote location + uses: qprofiles-manager + with: + action: download + source: https://gitlab.com/charente-eaux/ocarhy/profils-qgis.git + protocol: git + branch: main + + - name: Download plugins + uses: qplugins-downloader + with: + force: false + threads: 5 + + - name: Synchronize plugins + uses: qplugins-synchronizer + with: + action: create_or_restore + profile_ref: downloaded + source: ~/.cache/qgis-deployment-toolbelt/plugins + + - name: Create shortcuts for profiles + uses: shortcuts-manager + with: + action: create_or_restore + include: + - profile: oslandia + label: "QGIS - Profil Oslandia" + additional_arguments: "--noversioncheck" + desktop: true + start_menu: true + icon: "qgis_icon_oslandia.ico" + qgis_path: "%PROGRAMFILES%\\QGIS\\3_22\\bin\\qgis-bin.exe" + + - name: Set splash screen + uses: splash-screen-manager + with: + action: create_or_restore + strict: false + + - name: Create report + uses: telemetry-manager + with: + action: send + module: sentry + + - name: Send log + uses: telemetry-manager + with: + action: send + module: sentry From 10c4d25804a71278fc9c55e0c9f52c7a14c5dff5 Mon Sep 17 00:00:00 2001 From: "Julien M." Date: Fri, 29 Dec 2023 17:30:10 +0100 Subject: [PATCH 2/2] fix: convert ini_file from Path to ConfigParser when switch is False --- qgis_deployment_toolbelt/profiles/qgis_ini_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qgis_deployment_toolbelt/profiles/qgis_ini_handler.py b/qgis_deployment_toolbelt/profiles/qgis_ini_handler.py index 3b05338e..fcf72257 100644 --- a/qgis_deployment_toolbelt/profiles/qgis_ini_handler.py +++ b/qgis_deployment_toolbelt/profiles/qgis_ini_handler.py @@ -404,7 +404,7 @@ def set_splash_screen( pass # make sure that the file exists - if isinstance(ini_file, Path) and ini_file.exists() and switch: + if isinstance(ini_file, Path) and ini_file.exists(): # open cfg_parser = self.cfg_parser() cfg_parser.read(ini_file, encoding="UTF8")