From 70dbba11a6f8f8a7232c129cbeb894e240939af8 Mon Sep 17 00:00:00 2001 From: Lauri Kajan Date: Tue, 24 Sep 2024 13:24:11 +0300 Subject: [PATCH 01/14] Update action versions --- .github/workflows/code-style.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 7da22cd..3872b9b 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -9,6 +9,6 @@ jobs: code-style: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - uses: pre-commit/action@v2.0.2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - uses: pre-commit/action@v3.0.1 From b191a38e6f38e0645f77762bb9df3f74bdbb24ed Mon Sep 17 00:00:00 2001 From: Lauri Kajan Date: Tue, 24 Sep 2024 13:25:48 +0300 Subject: [PATCH 02/14] Upgrade pre-commit hooks to latest versions --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e63b6ba..2554c27 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,18 +2,18 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - id: check-added-large-files - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.8.0 + rev: v1.11.2 hooks: - id: mypy - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.11 + rev: v0.6.5 hooks: # Run the linter. - id: ruff From bb26aeb2b98a7e553d5498a216806bfe447094f1 Mon Sep 17 00:00:00 2001 From: Lauri Kajan Date: Tue, 24 Sep 2024 15:28:33 +0300 Subject: [PATCH 03/14] Fix format, typing, linting errors --- arho_feature_template/__init__.py | 6 +++--- arho_feature_template/core/feature_template_library.py | 10 +++++----- arho_feature_template/core/forms/add_feature_form.py | 2 +- .../core/forms/feature_attribute_form.py | 3 ++- .../core/panels/template_library_panel.py | 3 ++- arho_feature_template/plugin.py | 3 ++- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/arho_feature_template/__init__.py b/arho_feature_template/__init__.py index 20b518a..38a8b06 100644 --- a/arho_feature_template/__init__.py +++ b/arho_feature_template/__init__.py @@ -2,9 +2,9 @@ from typing import TYPE_CHECKING from arho_feature_template.qgis_plugin_tools.infrastructure.debugging import ( - setup_debugpy, # noqa F401 - setup_ptvsd, # noqa F401 - setup_pydevd, # noqa F401 + setup_debugpy, # noqa: F401 + setup_ptvsd, # noqa: F401 + setup_pydevd, # noqa: F401 ) if TYPE_CHECKING: diff --git a/arho_feature_template/core/feature_template_library.py b/arho_feature_template/core/feature_template_library.py index d37e814..a181881 100644 --- a/arho_feature_template/core/feature_template_library.py +++ b/arho_feature_template/core/feature_template_library.py @@ -13,7 +13,7 @@ class FeatureTemplateLibrary: """Class for storing FeatureTemplates and loading them from a JSON (or other conf. file).""" def __init__(self, json_path: str | PathLike): - self.templates = [] + self.templates: list[FeatureTemplate] = [] library_dict = self.read_json(json_path) self.build_templates(library_dict) @@ -23,13 +23,13 @@ def read_json(self, json_path: str | PathLike) -> dict: return json.load(f) def build_templates(self, library_dict: dict): - templates = [] + templates: list[FeatureTemplate] = [] _templates_raw = library_dict["templates"] # for template_raw in templates_raw: - ## ... build FeatureTemplate from dict here, in FeatureTemplate class or elsewhere? - # template = FeatureTemplate() - # templates.append(template) + ## ... build FeatureTemplate from dict here, in FeatureTemplate class or elsewhere? + # template = FeatureTemplate() + # templates.append(template) self.templates = templates def get_templates(self) -> Sequence[FeatureTemplate]: diff --git a/arho_feature_template/core/forms/add_feature_form.py b/arho_feature_template/core/forms/add_feature_form.py index 6a3e4db..45c40d6 100644 --- a/arho_feature_template/core/forms/add_feature_form.py +++ b/arho_feature_template/core/forms/add_feature_form.py @@ -10,7 +10,7 @@ def __init__(self, feature_template: FeatureTemplate): def _init_feature_attributes(self): # for feature_attribute in self.feature_template.feature_attributes: - # # Create the form here, add rows with labels and input fields + # # Create the form here, add rows with labels and input fields pass def save(self): diff --git a/arho_feature_template/core/forms/feature_attribute_form.py b/arho_feature_template/core/forms/feature_attribute_form.py index 855c96a..bbc23fb 100644 --- a/arho_feature_template/core/forms/feature_attribute_form.py +++ b/arho_feature_template/core/forms/feature_attribute_form.py @@ -8,7 +8,8 @@ ui_path = resources.files(__package__) / "feature_attribute_form.ui" FormClass, _ = uic.loadUiType(ui_path) -class FeatureAttributeForm(QDialog, FormClass): + +class FeatureAttributeForm(QDialog, FormClass): # type: ignore """Parent class for feature forms for adding and modifying feature attribute data.""" def __init__(self, feature_template: FeatureTemplate): diff --git a/arho_feature_template/core/panels/template_library_panel.py b/arho_feature_template/core/panels/template_library_panel.py index 9dd77ce..9c04a9c 100644 --- a/arho_feature_template/core/panels/template_library_panel.py +++ b/arho_feature_template/core/panels/template_library_panel.py @@ -8,7 +8,8 @@ ui_path = resources.files(__package__) / "template_library_panel.ui" FormClass, _ = uic.loadUiType(ui_path) -class TemplateLibraryPanel(QWidget, FormClass): + +class TemplateLibraryPanel(QWidget, FormClass): # type: ignore """Dock widget for selecting a feature template.""" def __init__(self, feature_template_library: FeatureTemplateLibrary): diff --git a/arho_feature_template/plugin.py b/arho_feature_template/plugin.py index 9a636b4..9b7b3a6 100644 --- a/arho_feature_template/plugin.py +++ b/arho_feature_template/plugin.py @@ -16,6 +16,7 @@ LIBRARY_JSON = resources_path("asemakaava-template-library-test.json") + class Plugin: """QGIS Plugin Implementation.""" @@ -128,7 +129,7 @@ def unload(self) -> None: teardown_logger(Plugin.name) def run(self) -> None: - self.feature_template_dock= QgsDockWidget() + self.feature_template_dock = QgsDockWidget() self.add_feature_panel = TemplateLibraryPanel(self.active_library) self.feature_template_dock.setWidget(self.add_feature_panel) self.feature_template_dock.setWindowTitle("ARHO") # NOTE: Placeholder name From 61d6a872d273960b14e5261691053bd7a7c020b8 Mon Sep 17 00:00:00 2001 From: Lauri Kajan Date: Tue, 24 Sep 2024 13:28:02 +0300 Subject: [PATCH 04/14] Check only on pushes to main --- .github/workflows/code-style.yml | 2 +- .github/workflows/test-and-pre-release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 3872b9b..be31c34 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -3,7 +3,7 @@ name: code-style on: pull_request: push: - branches: [master, main] + branches: [main] jobs: code-style: diff --git a/.github/workflows/test-and-pre-release.yml b/.github/workflows/test-and-pre-release.yml index fc89ee0..749cae7 100644 --- a/.github/workflows/test-and-pre-release.yml +++ b/.github/workflows/test-and-pre-release.yml @@ -6,7 +6,7 @@ name: Tests on: pull_request: push: - branches: [master, main] + branches: [main] # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: From 6d931fea7fc8bb8af1a95edb652474c5e406db2d Mon Sep 17 00:00:00 2001 From: Lauri Kajan Date: Tue, 24 Sep 2024 15:07:32 +0300 Subject: [PATCH 05/14] Remove codecov upload --- .github/workflows/test-and-pre-release.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/test-and-pre-release.yml b/.github/workflows/test-and-pre-release.yml index 749cae7..4408598 100644 --- a/.github/workflows/test-and-pre-release.yml +++ b/.github/workflows/test-and-pre-release.yml @@ -36,16 +36,6 @@ jobs: "pip3 install -qr requirements-dev.txt && xvfb-run -s '+extension GLX -screen 0 1024x768x24' pytest -v --cov=arho_feature_template --cov-report=xml" - # Upload coverage report. Will not work if the repo is private - - name: Upload coverage to Codecov - if: ${{ matrix.docker_tags == 'latest' && !github.event.repository.private }} - uses: codecov/codecov-action@v1 - with: - file: ./coverage.xml - flags: unittests - fail_ci_if_error: false # set to true when upload is working - verbose: false - windows_tests: runs-on: windows-latest From 8d024d4b5110a97c18eeab3749034eeffa17d88a Mon Sep 17 00:00:00 2001 From: Lauri Kajan Date: Tue, 24 Sep 2024 15:08:18 +0300 Subject: [PATCH 06/14] Fix PATH for Windows tests --- .github/workflows/test-and-pre-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-and-pre-release.yml b/.github/workflows/test-and-pre-release.yml index 4408598..2be0bd3 100644 --- a/.github/workflows/test-and-pre-release.yml +++ b/.github/workflows/test-and-pre-release.yml @@ -52,7 +52,8 @@ jobs: - name: Run tests shell: pwsh run: | - $env:PATH="C:\Program Files\QGIS 3.16\bin;$env:PATH" + $env:QGIS_PATH = (Get-ChildItem "C:\Program Files\QGIS *\bin" | Select-Object -First 1 -ExpandProperty FullName) + $env:PATH="$env:QGIS_PATH;$env:PATH" $env:QGIS_PLUGIN_IN_CI=1 python-qgis-ltr.bat -m pip install -qr requirements-dev.txt python-qgis-ltr.bat -m pytest -v From 205beff1970a33f16c1f7a1b898157b2965ebdfb Mon Sep 17 00:00:00 2001 From: Lauri Kajan Date: Tue, 24 Sep 2024 15:09:11 +0300 Subject: [PATCH 07/14] Use container style in gh action --- .github/workflows/test-and-pre-release.yml | 26 ++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test-and-pre-release.yml b/.github/workflows/test-and-pre-release.yml index 2be0bd3..bf28359 100644 --- a/.github/workflows/test-and-pre-release.yml +++ b/.github/workflows/test-and-pre-release.yml @@ -13,28 +13,36 @@ jobs: linux_tests: # The type of runner that the job will run on runs-on: ubuntu-latest + container: + image: qgis/qgis:${{ matrix.qgis-image-tags }} strategy: matrix: # Remove unsupported versions and add more versions. Use LTR version in the cov_tests job - docker_tags: [release-3_10, release-3_16, latest] + qgis-image-tags: [release-3_28, release-3_34, latest] fail-fast: false # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: true - - name: Pull qgis - run: docker pull qgis/qgis:${{ matrix.docker_tags }} + - name: Install dependencies + run: | + pip3 install virtualenv + virtualenv .venv --system-site-packages + source .venv/bin/activate + pip install -qr requirements-dev.txt --no-deps + pip install . --no-deps - # Runs all tests - name: Run tests - run: > - docker run --rm --net=host --volume `pwd`:/app -w=/app -e QGIS_PLUGIN_IN_CI=1 qgis/qgis:${{ matrix.docker_tags }} sh -c - "pip3 install -qr requirements-dev.txt && xvfb-run -s '+extension GLX -screen 0 1024x768x24' - pytest -v --cov=arho_feature_template --cov-report=xml" + env: + QGIS_PLUGIN_IN_CI: 1 + QT_QPA_PLATFORM: offscreen + run: | + source .venv/bin/activate + pytest windows_tests: runs-on: windows-latest From c22869fef4c2a0cce5ad4da4d046e23c3352e930 Mon Sep 17 00:00:00 2001 From: Lauri Kajan Date: Tue, 24 Sep 2024 15:10:31 +0300 Subject: [PATCH 08/14] Remove pre-releases from tests Let's first get the testing working and then complete the workflows with releases etc. --- .github/workflows/release.yml | 31 -------------- .github/workflows/test-and-pre-release.yml | 50 ---------------------- 2 files changed, 81 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index fe56209..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Release - -on: - release: - types: released - -jobs: - plugin_dst: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - - name: Set up Python 3.8 - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - # Needed if the plugin is using Transifex, to have the lrelease command - # - name: Install Qt lrelease - # run: sudo apt-get update && sudo apt-get install qt5-default qttools5-dev-tools - - - name: Install qgis-plugin-ci - run: pip3 install qgis-plugin-ci - - # When osgeo upload is wanted: --osgeo-username usrname --osgeo-password ${{ secrets.OSGEO_PASSWORD }} - # When Transifex is wanted: --transifex-token ${{ secrets.TRANSIFEX_TOKEN }} - - name: Deploy plugin - run: qgis-plugin-ci release ${GITHUB_REF/refs\/tags\//} --github-token ${{ secrets.GITHUB_TOKEN }} --disable-submodule-update diff --git a/.github/workflows/test-and-pre-release.yml b/.github/workflows/test-and-pre-release.yml index bf28359..298b3c8 100644 --- a/.github/workflows/test-and-pre-release.yml +++ b/.github/workflows/test-and-pre-release.yml @@ -65,53 +65,3 @@ jobs: $env:QGIS_PLUGIN_IN_CI=1 python-qgis-ltr.bat -m pip install -qr requirements-dev.txt python-qgis-ltr.bat -m pytest -v - - pre-release: - name: "Pre Release" - runs-on: "ubuntu-latest" - needs: [linux_tests, windows_tests] - - steps: - - uses: hmarr/debug-action@v2 - - - uses: "marvinpinto/action-automatic-releases@latest" - if: ${{ github.event.pull_request }} - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "dev-pr" - prerelease: true - title: "Development Build made for PR #${{ github.event.number }}" - - - uses: "marvinpinto/action-automatic-releases@latest" - if: ${{ github.event.after != github.event.before }} - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "dev" - prerelease: true - title: "Development Build made for master branch" - - - uses: actions/checkout@v2 - with: - submodules: true - - - name: Set up Python 3.8 - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - # Needed if the plugin is using Transifex, to have the lrelease command - # - name: Install Qt lrelease - # run: sudo apt-get update && sudo apt-get install qt5-default qttools5-dev-tools - - - name: Install qgis-plugin-ci - run: pip3 install qgis-plugin-ci - - # When Transifex is wanted: --transifex-token ${{ secrets.TRANSIFEX_TOKEN }} - - name: Deploy plugin - if: ${{ github.event.pull_request }} - run: qgis-plugin-ci release dev-pr --github-token ${{ secrets.GITHUB_TOKEN }} --disable-submodule-update - - # When Transifex is wanted: --transifex-token ${{ secrets.TRANSIFEX_TOKEN }} - - name: Deploy plugin - if: ${{ github.event.after != github.event.before }} - run: qgis-plugin-ci release dev --github-token ${{ secrets.GITHUB_TOKEN }} --disable-submodule-update From 7ea0dbb264b9e18b9c25f4caec48b0e2cfaa0b11 Mon Sep 17 00:00:00 2001 From: Lauri Kajan Date: Tue, 24 Sep 2024 15:17:46 +0300 Subject: [PATCH 09/14] Rename workflow to tests --- .github/workflows/{test-and-pre-release.yml => tests.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{test-and-pre-release.yml => tests.yml} (100%) diff --git a/.github/workflows/test-and-pre-release.yml b/.github/workflows/tests.yml similarity index 100% rename from .github/workflows/test-and-pre-release.yml rename to .github/workflows/tests.yml From 2c04ead6891878887bbf8cb9d82cff92aac4c3c1 Mon Sep 17 00:00:00 2001 From: Lauri Kajan Date: Tue, 24 Sep 2024 15:57:59 +0300 Subject: [PATCH 10/14] Add compiled requirements Use uv to compile requirements cross platform using Python 3.9 to get dependency installation working on QGIS docker images having an older Python version. --- requirements-dev.txt | 79 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/requirements-dev.txt b/requirements-dev.txt index e69de29..f602060 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -0,0 +1,79 @@ +# This file was autogenerated by uv via the following command: +# uv pip compile --universal -o requirements-dev.txt requirements-dev.in --python-version 3.9 +-e file:. + # via -r requirements-dev.in +astor==0.8.1 + # via flake8-qgis +cfgv==3.4.0 + # via pre-commit +colorama==0.4.6 ; sys_platform == 'win32' + # via pytest +coverage==7.6.1 + # via pytest-cov +debugpy==1.8.6 + # via -r requirements-dev.in +distlib==0.3.8 + # via virtualenv +exceptiongroup==1.2.2 ; python_full_version < '3.11' + # via pytest +filelock==3.16.1 + # via virtualenv +flake8==7.1.1 + # via + # -r requirements-dev.in + # flake8-qgis +flake8-qgis==1.0.0 + # via -r requirements-dev.in +identify==2.6.1 + # via pre-commit +iniconfig==2.0.0 + # via pytest +mccabe==0.7.0 + # via flake8 +mypy==1.11.2 + # via -r requirements-dev.in +mypy-extensions==1.0.0 + # via mypy +nodeenv==1.9.1 + # via pre-commit +packaging==24.1 + # via pytest +platformdirs==4.3.6 + # via virtualenv +pluggy==1.5.0 + # via + # pytest + # pytest-qt +pre-commit==3.8.0 + # via -r requirements-dev.in +pycodestyle==2.12.1 + # via flake8 +pyflakes==3.2.0 + # via flake8 +pyqt5-stubs==5.15.6.0 + # via -r requirements-dev.in +pytest==8.3.3 + # via + # -r requirements-dev.in + # pytest-cov + # pytest-qgis + # pytest-qt +pytest-cov==5.0.0 + # via -r requirements-dev.in +pytest-qgis==2.1.0 + # via -r requirements-dev.in +pytest-qt==4.4.0 + # via -r requirements-dev.in +pyyaml==6.0.2 + # via pre-commit +ruff==0.6.7 + # via -r requirements-dev.in +tomli==2.0.1 ; python_full_version <= '3.11' + # via + # coverage + # mypy + # pytest +typing-extensions==4.12.2 + # via mypy +virtualenv==20.26.5 + # via pre-commit From 413934450c68b2e53f5e2a192739c473abc5c98d Mon Sep 17 00:00:00 2001 From: Lauri Kajan Date: Tue, 24 Sep 2024 15:57:43 +0300 Subject: [PATCH 11/14] Fix install command --- .github/workflows/tests.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 298b3c8..d991812 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -30,19 +30,17 @@ jobs: - name: Install dependencies run: | - pip3 install virtualenv - virtualenv .venv --system-site-packages - source .venv/bin/activate - pip install -qr requirements-dev.txt --no-deps - pip install . --no-deps + apt update && apt install python3-venv -y + python3 -m venv --system-site-packages .venv + .venv/bin/python -m pip install -U setuptools pip + .venv/bin/pip install -r requirements-dev.txt - name: Run tests env: QGIS_PLUGIN_IN_CI: 1 QT_QPA_PLATFORM: offscreen run: | - source .venv/bin/activate - pytest + .venv/bin/pytest windows_tests: runs-on: windows-latest From 1fb78d5adb7a115ee39127a067b2499910722c71 Mon Sep 17 00:00:00 2001 From: Lauri Kajan Date: Wed, 25 Sep 2024 15:03:16 +0300 Subject: [PATCH 12/14] Separate test dependencies --- .github/workflows/tests.yml | 3 ++- requirements-dev.in | 14 ++++++-------- requirements-dev.txt | 33 +++------------------------------ requirements-test.in | 5 +++++ requirements-test.txt | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 48 insertions(+), 39 deletions(-) create mode 100644 requirements-test.in create mode 100644 requirements-test.txt diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d991812..2dcb64f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,7 +33,8 @@ jobs: apt update && apt install python3-venv -y python3 -m venv --system-site-packages .venv .venv/bin/python -m pip install -U setuptools pip - .venv/bin/pip install -r requirements-dev.txt + .venv/bin/pip install -r requirements-test.txt + .venv/bin/pip install . - name: Run tests env: diff --git a/requirements-dev.in b/requirements-dev.in index 42e975a..feec196 100644 --- a/requirements-dev.in +++ b/requirements-dev.in @@ -1,13 +1,8 @@ -# Debugging -debugpy -# Dependency maintenance -pip-tools +-c requirements-test.txt -# Testing -pytest -pytest-cov -pytest-qgis +# Debugging +debugpy # Linting and formatting pre-commit @@ -18,3 +13,6 @@ flake8-qgis # Stubs PyQt5-stubs + +# repo itself +-e file:. diff --git a/requirements-dev.txt b/requirements-dev.txt index f602060..966afb7 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,21 +1,15 @@ # This file was autogenerated by uv via the following command: -# uv pip compile --universal -o requirements-dev.txt requirements-dev.in --python-version 3.9 +# uv pip compile --universal --python-version 3.9 -o requirements-dev.txt requirements-dev.in -e file:. # via -r requirements-dev.in astor==0.8.1 # via flake8-qgis cfgv==3.4.0 # via pre-commit -colorama==0.4.6 ; sys_platform == 'win32' - # via pytest -coverage==7.6.1 - # via pytest-cov debugpy==1.8.6 # via -r requirements-dev.in distlib==0.3.8 # via virtualenv -exceptiongroup==1.2.2 ; python_full_version < '3.11' - # via pytest filelock==3.16.1 # via virtualenv flake8==7.1.1 @@ -26,8 +20,6 @@ flake8-qgis==1.0.0 # via -r requirements-dev.in identify==2.6.1 # via pre-commit -iniconfig==2.0.0 - # via pytest mccabe==0.7.0 # via flake8 mypy==1.11.2 @@ -36,14 +28,8 @@ mypy-extensions==1.0.0 # via mypy nodeenv==1.9.1 # via pre-commit -packaging==24.1 - # via pytest platformdirs==4.3.6 # via virtualenv -pluggy==1.5.0 - # via - # pytest - # pytest-qt pre-commit==3.8.0 # via -r requirements-dev.in pycodestyle==2.12.1 @@ -52,27 +38,14 @@ pyflakes==3.2.0 # via flake8 pyqt5-stubs==5.15.6.0 # via -r requirements-dev.in -pytest==8.3.3 - # via - # -r requirements-dev.in - # pytest-cov - # pytest-qgis - # pytest-qt -pytest-cov==5.0.0 - # via -r requirements-dev.in -pytest-qgis==2.1.0 - # via -r requirements-dev.in -pytest-qt==4.4.0 - # via -r requirements-dev.in pyyaml==6.0.2 # via pre-commit ruff==0.6.7 # via -r requirements-dev.in -tomli==2.0.1 ; python_full_version <= '3.11' +tomli==2.0.1 ; python_full_version < '3.11' # via - # coverage + # -c requirements-test.txt # mypy - # pytest typing-extensions==4.12.2 # via mypy virtualenv==20.26.5 diff --git a/requirements-test.in b/requirements-test.in new file mode 100644 index 0000000..00c9d64 --- /dev/null +++ b/requirements-test.in @@ -0,0 +1,5 @@ +# Testing +pytest +pytest-qt +pytest-cov +pytest-qgis diff --git a/requirements-test.txt b/requirements-test.txt new file mode 100644 index 0000000..f649c92 --- /dev/null +++ b/requirements-test.txt @@ -0,0 +1,32 @@ +# This file was autogenerated by uv via the following command: +# uv pip compile --universal --python-version 3.9 -o requirements-test.txt requirements-test.in +colorama==0.4.6 ; sys_platform == 'win32' + # via pytest +coverage==7.6.1 + # via pytest-cov +exceptiongroup==1.2.2 ; python_full_version < '3.11' + # via pytest +iniconfig==2.0.0 + # via pytest +packaging==24.1 + # via pytest +pluggy==1.5.0 + # via + # pytest + # pytest-qt +pytest==8.3.3 + # via + # -r requirements-test.in + # pytest-cov + # pytest-qgis + # pytest-qt +pytest-cov==5.0.0 + # via -r requirements-test.in +pytest-qgis==2.1.0 + # via -r requirements-test.in +pytest-qt==4.4.0 + # via -r requirements-test.in +tomli==2.0.1 ; python_full_version <= '3.11' + # via + # coverage + # pytest From 00396c8cc6e67fe72a288890541dae7ae740a14e Mon Sep 17 00:00:00 2001 From: Lauri Kajan Date: Wed, 25 Sep 2024 15:03:00 +0300 Subject: [PATCH 13/14] Make package installable --- .github/workflows/tests.yml | 3 ++- pyproject.toml | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2dcb64f..7051b3f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -62,5 +62,6 @@ jobs: $env:QGIS_PATH = (Get-ChildItem "C:\Program Files\QGIS *\bin" | Select-Object -First 1 -ExpandProperty FullName) $env:PATH="$env:QGIS_PATH;$env:PATH" $env:QGIS_PLUGIN_IN_CI=1 - python-qgis-ltr.bat -m pip install -qr requirements-dev.txt + python-qgis-ltr.bat -m pip install -qr requirements-test.txt + python-qgis-ltr.bat -m pip install . python-qgis-ltr.bat -m pytest -v diff --git a/pyproject.toml b/pyproject.toml index 7d62774..7e2b69e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,15 @@ +[build-system] +requires = ["setuptools >= 61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "arho-feature-template" +version = "0.1.0" +requires-python = ">= 3.8" + +[tool.setuptools] +packages = ["arho_feature_template"] + [tool.pytest.ini_options] addopts = "-v" From c510058202a9f62cb88d05519ff3dd58c614601d Mon Sep 17 00:00:00 2001 From: Lauri Kajan Date: Wed, 25 Sep 2024 07:57:42 +0300 Subject: [PATCH 14/14] Test only own tests --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 7e2b69e..d8ae2c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,6 +12,7 @@ packages = ["arho_feature_template"] [tool.pytest.ini_options] addopts = "-v" +testpaths = "tests" [tool.coverage.report] omit = ["arho_feature_template/qgis_plugin_tools/*"]