From 90e1cf1c70f2df847785a04532f5f2fc8dc26123 Mon Sep 17 00:00:00 2001 From: Paolo Tormene Date: Mon, 12 Feb 2024 11:01:20 +0100 Subject: [PATCH 01/11] Add an action to install QGIS on Windows --- .github/workflows/test_windows.yml | 128 +++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 .github/workflows/test_windows.yml diff --git a/.github/workflows/test_windows.yml b/.github/workflows/test_windows.yml new file mode 100644 index 000000000..23cd8bdb2 --- /dev/null +++ b/.github/workflows/test_windows.yml @@ -0,0 +1,128 @@ +name: QGIS LTR integration tests IRMT vs Engine (LTR and latest) +on: + # NOTE: enables only scheduled or triggered manually, NOT on pull requests + workflow_dispatch: + inputs: + git-ref: + description: Git Ref + default: master + required: true + # push: + # branches: + # - '**' + schedule: + - cron: "0 3 * * *" + +jobs: + Tests_and_docs: + strategy: + fail-fast: false + matrix: + # NOTE: checking also master to make sure risk workshop demos keep working also on master + # TODO: it would be better to point to lts and latest if possible + # ENGINE_BR: ['engine-3.16', 'engine-3.18', 'master'] + ENGINE_BR: [master'] + # NOTE: keep it updated with QGIS ltr + # QGIS_DOCKER_VERSION: ['qgis/qgis:release-3_28', 'qgis/qgis:latest'] + # QGIS_INSTALLER: ['QGIS-OSGeo4W-3.28.14-1.msi', 'QGIS-OSGeo4W-3.34.3-1.msi'] + QGIS_INSTALLER: ['QGIS-OSGeo4W-3.28.14-1.msi'] + # DEMOS: ['oqdata', 'risk-oqdata'] + DEMOS: ['risk-oqdata'] + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - name: 🐍 Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.10' + ref: ${{ matrix.ENGINE_BR }} + - name: Install QGIS + run: | + curl https://qgis.org/downloads/${{ matrix.QGIS_INSTALLER }} + .\${{ matrix.QGIS_INSTALLER }} /quiet /passive + Start-Process -FilePath ".\QGIS-OSGeo4W-3.28.14-1.msi" -ArgumentList "/quiet /passive" -Wait; + - name: ⏳ Clone engine and restore oqdata + run: | + set -x + echo "Running on ${{ matrix.os }}" + ENGINE_BR=${{ matrix.ENGINE_BR }} + IRMT_BR=$ENGINE_BR + git fetch + git checkout $IRMT_BR + curl -O https://raw.githubusercontent.com/gem/oq-engine/master/install.py + ls -lrt install.py + echo "Using branch ${ENGINE_BR}" + if [ "$(git ls-remote --heads https://github.com/gem/oq-engine.git ${ENGINE_BR})" = "" ]; then + echo "Branch ${ENGINE_BR} not found in gem/oq-engine repository" + exit 1 + fi + # get release version from branch name (e.g. 'engine-3.16' -> '3.16') + prefix="engine-" + if [[ $ENGINE_BR == ${prefix}* ]]; then + RELEASE_VERSION="${ENGINE_BR#${prefix}}" + else + RELEASE_VERSION=$ENGINE_BR + fi + python3 install.py user --version=${RELEASE_VERSION} + export PIP_DEFAULT_TIMEOUT=100 + echo "Restore ${{matrix.DEMOS}} demos for $ENGINE_BR branch " + source $HOME/openquake/bin/activate + oq reset -y + oq restore https://artifacts.openquake.org/travis/${{matrix.DEMOS}}-${ENGINE_BR}.zip ~/oqdata + oq webui start --skip-browser >> webui.log 2>&1 & + echo "Waiting WEBUI up on port 8800...." + while ! nc -z 172.17.0.1 8800; do + sleep 5 + done + curl http://172.17.0.1:8800/v1/engine_version + # + # DOCKER_HOST=`ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+'` + # ENGINE_HOST=`echo http://$DOCKER_HOST:8800` + # # NOTE: release-3_28 needs to be kept updated to the current LTS + # docker run -d --name qgis -v /tmp/.X11-unix:/tmp/.X11-unix -v `pwd`:/tests_directory -e DISPLAY=:99 -e OQ_ENGINE_HOST='http://172.17.0.1:8800' \ + # -e BRANCH="$IRMT_BR" -e ONLY_CALC_ID="$ONLY_CALC_ID" -e ONLY_OUTPUT_TYPE="$ONLY_OUTPUT_TYPE" -e GEM_QGIS_TEST=y ${{ matrix.QGIS_DOCKER_VERSION }} + # docker exec qgis bash -c "apt update --allow-releaseinfo-change; DEBIAN_FRONTEND=noninteractive apt install -y python3-scipy python3-matplotlib python3-pyqt5.qtwebkit" + # docker exec qgis bash -c "python3 -m pip install pytest" + # # OGR_SQLITE_JOURNAL=delete prevents QGIS from using WAL, which modifies geopackages even if they are just read + - name: ℧ Run unit test + run: | + set -x + ENGINE_BR=${{ matrix.ENGINE_BR }} + IRMT_BR=$ENGINE_BR + git fetch + git checkout $IRMT_BR + # docker exec -t qgis bash -c "export PYTHONPATH=/usr/share/qgis/python/plugins/:$PYTHONPATH; OGR_SQLITE_JOURNAL=delete pytest -v /tests_directory/svir/test/unit/" + - name: ⨕ Run Integration test + run: | + set -x + ENGINE_BR=${{ matrix.ENGINE_BR }} + IRMT_BR=$ENGINE_BR + git fetch + git checkout $IRMT_BR + # get release version from branch name (e.g. 'engine-3.16' -> '3.16') + prefix="engine-" + if [[ $ENGINE_BR == ${prefix}* ]]; then + RELEASE_VERSION="${ENGINE_BR#${prefix}}" + else + RELEASE_VERSION=$ENGINE_BR + fi + # NOTE: if we want to enable it, we need to use the proper folder after engine user installation + OQ_TEST_RUN_CALC=0 + if [ "${{ matrix.DEMOS }}" != "risk-oqdata" -a "${RELEASE_VERSION}" != "3.16" ]; then + OQ_CHECK_MISSING_OUTPUTS=1 + else + OQ_CHECK_MISSING_OUTPUTS=0 + fi + echo "OQ_CHECK_MISSING_OUTPUTS: ${OQ_CHECK_MISSING_OUTPUTS}" + echo "OQ_TEST_RUN_CALC: ${OQ_TEST_RUN_CALC}" + # # NOTE: the check on the existence of the engine branch is already done in the previous step + # docker exec qgis sh -c "echo 'Running against oq-engine on branch ${ENGINE_BR}'" + # docker exec qgis sh -c "qgis_setup.sh svir" + # docker exec -e OQ_CHECK_MISSING_OUTPUTS=${OQ_CHECK_MISSING_OUTPUTS} -e OQ_TEST_RUN_CALC=${OQ_TEST_RUN_CALC} \ + # -t qgis sh -c "env && cd /tests_directory && qgis_testrunner.sh svir.test.integration.test_drive_oq_engine" + - name: ㏒ Save webui log as artifact + uses: actions/upload-artifact@v2 + if: always() + with: + name: WebUI-log + path: webui.log From 80e10a1cfb6da8a7c3c29d4190993afd32477fbf Mon Sep 17 00:00:00 2001 From: Paolo Tormene Date: Mon, 12 Feb 2024 11:30:32 +0100 Subject: [PATCH 02/11] Change name of the action for Windows --- .github/workflows/test_windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_windows.yml b/.github/workflows/test_windows.yml index 23cd8bdb2..7f48f4860 100644 --- a/.github/workflows/test_windows.yml +++ b/.github/workflows/test_windows.yml @@ -1,4 +1,4 @@ -name: QGIS LTR integration tests IRMT vs Engine (LTR and latest) +name: Test on Windows on: # NOTE: enables only scheduled or triggered manually, NOT on pull requests workflow_dispatch: From 44f57e96f5b19797c04efc57705ad31eef826772 Mon Sep 17 00:00:00 2001 From: Paolo Tormene Date: Mon, 12 Feb 2024 11:36:20 +0100 Subject: [PATCH 03/11] Run test_windows action on push (temporarily) --- .github/workflows/test_windows.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_windows.yml b/.github/workflows/test_windows.yml index 7f48f4860..18b242dac 100644 --- a/.github/workflows/test_windows.yml +++ b/.github/workflows/test_windows.yml @@ -7,11 +7,11 @@ on: description: Git Ref default: master required: true - # push: - # branches: - # - '**' - schedule: - - cron: "0 3 * * *" + push: + branches: + - '**' + # schedule: + # - cron: "0 3 * * *" jobs: Tests_and_docs: From 684c21c895c77a919493f53de1a6fdcaf81ef2e4 Mon Sep 17 00:00:00 2001 From: Paolo Tormene Date: Mon, 12 Feb 2024 11:43:43 +0100 Subject: [PATCH 04/11] Wait curl, then run qgis installer --- .github/workflows/test_windows.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test_windows.yml b/.github/workflows/test_windows.yml index 18b242dac..f788deba6 100644 --- a/.github/workflows/test_windows.yml +++ b/.github/workflows/test_windows.yml @@ -38,9 +38,7 @@ jobs: ref: ${{ matrix.ENGINE_BR }} - name: Install QGIS run: | - curl https://qgis.org/downloads/${{ matrix.QGIS_INSTALLER }} - .\${{ matrix.QGIS_INSTALLER }} /quiet /passive - Start-Process -FilePath ".\QGIS-OSGeo4W-3.28.14-1.msi" -ArgumentList "/quiet /passive" -Wait; + curl https://qgis.org/downloads/${{ matrix.QGIS_INSTALLER }} && Start-Process -FilePath ".\{{ matrix.QGIS_INSTALLER }}" -ArgumentList "/quiet /passive" -Wait; - name: ⏳ Clone engine and restore oqdata run: | set -x From f69b80a5399a93cfab706f674535e059a6e894eb Mon Sep 17 00:00:00 2001 From: Paolo Tormene Date: Mon, 12 Feb 2024 11:51:34 +0100 Subject: [PATCH 05/11] Add missing $ --- .github/workflows/test_windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_windows.yml b/.github/workflows/test_windows.yml index f788deba6..6fe795f2b 100644 --- a/.github/workflows/test_windows.yml +++ b/.github/workflows/test_windows.yml @@ -38,7 +38,7 @@ jobs: ref: ${{ matrix.ENGINE_BR }} - name: Install QGIS run: | - curl https://qgis.org/downloads/${{ matrix.QGIS_INSTALLER }} && Start-Process -FilePath ".\{{ matrix.QGIS_INSTALLER }}" -ArgumentList "/quiet /passive" -Wait; + curl https://qgis.org/downloads/${{matrix.QGIS_INSTALLER}} && Start-Process -FilePath ".\${{matrix.QGIS_INSTALLER}}" -ArgumentList "/quiet /passive" -Wait; - name: ⏳ Clone engine and restore oqdata run: | set -x From d40904632b54f88015c20eb615826d7ea3cffe5f Mon Sep 17 00:00:00 2001 From: Paolo Tormene Date: Tue, 13 Feb 2024 09:45:58 +0100 Subject: [PATCH 06/11] Temporarily disable main action on push (to test only windows action) --- .github/workflows/test.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1462ce524..09bcaaa62 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,8 +1,9 @@ name: Unit and integration tests on: - push: - branches: - - '**' + # FIXME: restore tests on push + # push: + # branches: + # - '**' schedule: - cron: "0 1 * * *" From 2df405503c6913a552f7ce27f89002054ad518f5 Mon Sep 17 00:00:00 2001 From: Paolo Tormene Date: Tue, 13 Feb 2024 10:27:28 +0100 Subject: [PATCH 07/11] Ise WebClient DownloadFile instead of curl (slow and limited to a max size) --- .github/workflows/test_windows.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_windows.yml b/.github/workflows/test_windows.yml index 6fe795f2b..d0c1adf8d 100644 --- a/.github/workflows/test_windows.yml +++ b/.github/workflows/test_windows.yml @@ -38,7 +38,9 @@ jobs: ref: ${{ matrix.ENGINE_BR }} - name: Install QGIS run: | - curl https://qgis.org/downloads/${{matrix.QGIS_INSTALLER}} && Start-Process -FilePath ".\${{matrix.QGIS_INSTALLER}}" -ArgumentList "/quiet /passive" -Wait; + $WebClient = New-Object System.Net.WebClient + $WebClient.DownloadFile("https://qgis.org/downloads/${{matrix.QGIS_INSTALLER}}", ".\${{matrix.QGIS_INSTALLER}}" + Start-Process -FilePath ".\${{matrix.QGIS_INSTALLER}}" -ArgumentList "/quiet /passive" -Wait; - name: ⏳ Clone engine and restore oqdata run: | set -x From 8965da9609dfcf32533e4ddd72c412b91eacf30c Mon Sep 17 00:00:00 2001 From: Paolo Tormene Date: Tue, 13 Feb 2024 10:28:30 +0100 Subject: [PATCH 08/11] Add missing closed parenthesis --- .github/workflows/test_windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_windows.yml b/.github/workflows/test_windows.yml index d0c1adf8d..646129cf2 100644 --- a/.github/workflows/test_windows.yml +++ b/.github/workflows/test_windows.yml @@ -39,7 +39,7 @@ jobs: - name: Install QGIS run: | $WebClient = New-Object System.Net.WebClient - $WebClient.DownloadFile("https://qgis.org/downloads/${{matrix.QGIS_INSTALLER}}", ".\${{matrix.QGIS_INSTALLER}}" + $WebClient.DownloadFile("https://qgis.org/downloads/${{matrix.QGIS_INSTALLER}}", ".\${{matrix.QGIS_INSTALLER}}") Start-Process -FilePath ".\${{matrix.QGIS_INSTALLER}}" -ArgumentList "/quiet /passive" -Wait; - name: ⏳ Clone engine and restore oqdata run: | From fdfe8cdb0746862ddcf470092fcbd44f1d094a50 Mon Sep 17 00:00:00 2001 From: Paolo Tormene Date: Tue, 13 Feb 2024 11:20:30 +0100 Subject: [PATCH 09/11] Try to print qgis version after the installation is complete --- .github/workflows/test_windows.yml | 34 ++++++++++++++++-------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test_windows.yml b/.github/workflows/test_windows.yml index 646129cf2..c39ee06b7 100644 --- a/.github/workflows/test_windows.yml +++ b/.github/workflows/test_windows.yml @@ -40,11 +40,12 @@ jobs: run: | $WebClient = New-Object System.Net.WebClient $WebClient.DownloadFile("https://qgis.org/downloads/${{matrix.QGIS_INSTALLER}}", ".\${{matrix.QGIS_INSTALLER}}") - Start-Process -FilePath ".\${{matrix.QGIS_INSTALLER}}" -ArgumentList "/quiet /passive" -Wait; + Start-Process -FilePath ".\${{matrix.QGIS_INSTALLER}}" -ArgumentList "/quiet /passive" -Wait + # FIXME: make it parametric + 'C:\Program Files\QGIS 3.28.14\bin\qgis-ltr-bin.exe' --version | echo - name: ⏳ Clone engine and restore oqdata run: | set -x - echo "Running on ${{ matrix.os }}" ENGINE_BR=${{ matrix.ENGINE_BR }} IRMT_BR=$ENGINE_BR git fetch @@ -52,17 +53,18 @@ jobs: curl -O https://raw.githubusercontent.com/gem/oq-engine/master/install.py ls -lrt install.py echo "Using branch ${ENGINE_BR}" - if [ "$(git ls-remote --heads https://github.com/gem/oq-engine.git ${ENGINE_BR})" = "" ]; then - echo "Branch ${ENGINE_BR} not found in gem/oq-engine repository" - exit 1 - fi + # if [ "$(git ls-remote --heads https://github.com/gem/oq-engine.git ${ENGINE_BR})" = "" ]; then + # echo "Branch ${ENGINE_BR} not found in gem/oq-engine repository" + # exit 1 + # fi # get release version from branch name (e.g. 'engine-3.16' -> '3.16') - prefix="engine-" - if [[ $ENGINE_BR == ${prefix}* ]]; then - RELEASE_VERSION="${ENGINE_BR#${prefix}}" - else - RELEASE_VERSION=$ENGINE_BR - fi + # prefix="engine-" + # if [[ $ENGINE_BR == ${prefix}* ]]; then + # RELEASE_VERSION="${ENGINE_BR#${prefix}}" + # else + # RELEASE_VERSION=$ENGINE_BR + # fi + RELEASE_VERSION=master python3 install.py user --version=${RELEASE_VERSION} export PIP_DEFAULT_TIMEOUT=100 echo "Restore ${{matrix.DEMOS}} demos for $ENGINE_BR branch " @@ -70,10 +72,10 @@ jobs: oq reset -y oq restore https://artifacts.openquake.org/travis/${{matrix.DEMOS}}-${ENGINE_BR}.zip ~/oqdata oq webui start --skip-browser >> webui.log 2>&1 & - echo "Waiting WEBUI up on port 8800...." - while ! nc -z 172.17.0.1 8800; do - sleep 5 - done + # echo "Waiting WEBUI up on port 8800...." + # while ! nc -z 172.17.0.1 8800; do + # sleep 5 + # done curl http://172.17.0.1:8800/v1/engine_version # # DOCKER_HOST=`ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+'` From ac9943f789e3e70e2f3a51ef1b32b59a00236db3 Mon Sep 17 00:00:00 2001 From: Paolo Tormene Date: Tue, 13 Feb 2024 11:32:33 +0100 Subject: [PATCH 10/11] Prepend & when printing qgis version --- .github/workflows/test_windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_windows.yml b/.github/workflows/test_windows.yml index c39ee06b7..5f7c47e2c 100644 --- a/.github/workflows/test_windows.yml +++ b/.github/workflows/test_windows.yml @@ -42,7 +42,7 @@ jobs: $WebClient.DownloadFile("https://qgis.org/downloads/${{matrix.QGIS_INSTALLER}}", ".\${{matrix.QGIS_INSTALLER}}") Start-Process -FilePath ".\${{matrix.QGIS_INSTALLER}}" -ArgumentList "/quiet /passive" -Wait # FIXME: make it parametric - 'C:\Program Files\QGIS 3.28.14\bin\qgis-ltr-bin.exe' --version | echo + & 'C:\Program Files\QGIS 3.28.14\bin\qgis-ltr-bin.exe' --version | echo - name: ⏳ Clone engine and restore oqdata run: | set -x From b85b5aa6f8e9f6615859ff2731b6686701921b40 Mon Sep 17 00:00:00 2001 From: Paolo Tormene Date: Wed, 14 Feb 2024 17:20:56 +0100 Subject: [PATCH 11/11] Set env variables, run qgis from command line to install required python packages --- .github/workflows/test_windows.yml | 26 ++++++++++++++---- scripts/run_unit_tests.py | 34 ++++++++++++++++++++++++ svir/test/unit/test_calculate_indices.py | 2 ++ 3 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 scripts/run_unit_tests.py diff --git a/.github/workflows/test_windows.yml b/.github/workflows/test_windows.yml index 5f7c47e2c..10435fde5 100644 --- a/.github/workflows/test_windows.yml +++ b/.github/workflows/test_windows.yml @@ -50,6 +50,7 @@ jobs: IRMT_BR=$ENGINE_BR git fetch git checkout $IRMT_BR + cp -r svir\ .\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ curl -O https://raw.githubusercontent.com/gem/oq-engine/master/install.py ls -lrt install.py echo "Using branch ${ENGINE_BR}" @@ -64,11 +65,13 @@ jobs: # else # RELEASE_VERSION=$ENGINE_BR # fi + + # FIXME: use actual RELEASE_VERSION RELEASE_VERSION=master python3 install.py user --version=${RELEASE_VERSION} export PIP_DEFAULT_TIMEOUT=100 echo "Restore ${{matrix.DEMOS}} demos for $ENGINE_BR branch " - source $HOME/openquake/bin/activate + $home\openquake\Scripts\activate.ps1 oq reset -y oq restore https://artifacts.openquake.org/travis/${{matrix.DEMOS}}-${ENGINE_BR}.zip ~/oqdata oq webui start --skip-browser >> webui.log 2>&1 & @@ -89,10 +92,23 @@ jobs: - name: ℧ Run unit test run: | set -x - ENGINE_BR=${{ matrix.ENGINE_BR }} - IRMT_BR=$ENGINE_BR - git fetch - git checkout $IRMT_BR + pip install pytest + $OSGEO4W_ROOT = "C:\Program Files\QGIS 3.28.14\" + $QGISNAME = "qgis-ltr" + $QGIS = "$OSGEO4W_ROOT\apps\$QGISNAME" + $QGIS_PREFIX_PATH = $QGIS + & "$OSGEO4W_ROOT\bin\o4w_env.bat" + $PATH += ";$QGIS\bin" + $PYTHONPATH += ";$QGIS\python" + $LD_LIBRARY_PATH="$QGIS_PREFIX_PATH\lib" + pytest -v .\svir\test\unit\ + $OGR_SQLITE_JOURNAL=delete + & 'C:\Program Files\QGIS 3.28.14\bin\qgis-ltr-bin.exe' --nologo --code scripts\run_unit_tests.py + pytest -v svir/test/unit/ + # ENGINE_BR=${{ matrix.ENGINE_BR }} + # IRMT_BR=$ENGINE_BR + # git fetch + # git checkout $IRMT_BR # docker exec -t qgis bash -c "export PYTHONPATH=/usr/share/qgis/python/plugins/:$PYTHONPATH; OGR_SQLITE_JOURNAL=delete pytest -v /tests_directory/svir/test/unit/" - name: ⨕ Run Integration test run: | diff --git a/scripts/run_unit_tests.py b/scripts/run_unit_tests.py new file mode 100644 index 000000000..081cdcc52 --- /dev/null +++ b/scripts/run_unit_tests.py @@ -0,0 +1,34 @@ +import subprocess +import os +import pip +from qgis.core import QgsMessageLog, Qgis + +def install_packages(): + for package_name in ['pytest', 'matplotlib', 'scipy', 'pyqt5', 'pytest-qgis']: + subprocess.run(['pip', 'install', package_name], check=True) + # subprocess.run(['pip', 'uninstall', '-y', 'pdbpp'], check=True) + # for package_name in ['pytest', 'matplotlib', 'scipy', 'pyqt5']: + # subprocess.run(['pip', 'install', '-y', package_name], check=True) + # # pip.main('install', '-y', package_name], check=True) + # try: + # pytest_args = ['pytest', '-v', os.path.join('svir', 'test', 'unit')] + # subprocess.run(pytest_args, check=True) + # except subprocess.CalledProcessError as e: + # print(f"Pytest failed with return code {e.returncode}.") + # print(e.output.decode()) + # else: + # print("Pytest completed successfully.") + #pip.main(['pytest', 'pyqt5', 'matplotlib', 'scipy']) + +def run_pytest(): + # pytest_args = ['pytest', '-v', os.path.join('svir', 'test', 'unit')] + pytest_args = ['pytest', '-v', os.path.join('C:', 'Users', 'paolo.tormene', 'GIT', 'oq-irmt-qgis', 'svir', 'test', 'unit')] + sp = subprocess.run(pytest_args, check=False, shell=True, capture_output=True, text=True) + sp2 = subprocess.run(['echo', '%cd%'], check=False, shell=True, capture_output=True, text=True) + QgsMessageLog.logMessage("Unit tests completed: %s" % sp, level=Qgis.Info) + QgsMessageLog.logMessage("Unit tests completed: %s" % sp2, level=Qgis.Info) + +if __name__ == "__main__": + install_packages() + run_pytest() + # pip.main(['install', 'pytest']) #, 'pyqt5', 'matplotlib', 'scipy']) diff --git a/svir/test/unit/test_calculate_indices.py b/svir/test/unit/test_calculate_indices.py index 3f2407285..72b46f038 100644 --- a/svir/test/unit/test_calculate_indices.py +++ b/svir/test/unit/test_calculate_indices.py @@ -149,6 +149,8 @@ def setUp(self): self.layer = ProcessLayer(orig_layer).duplicate_in_memory() def test_custom_operator(self): + # FIXME + 1/0 proj_def = deepcopy(self.project_definition) operator = OPERATORS_DICT['CUSTOM'] # set economy's operator to custom and use a custom formula