Hi Sergi,as Germán wrote, you need to ensure that the PYTHONPATH contains the local QGIS plugin directory:
PYTHONPATH=/usr/share/qgis/python/pluginsIn addition the test suite may need to initialized the processing framework with:
from processing.core.Processing import Processing Processing.initialize() Greetings, Benjamin On 11/11/2025 15:18, Germán Carrillo via QGIS-Developer wrote:
Hi Sergi, I think I faced the same issue earlier this year.Have a look at our test.yaml file [1], we needed to pass PYTHONPATH to the docker run command.Hope that helps. Regards, Germán -----------[1] https://github.com/opengisch/pzp/blob/ f951fa3fa4ae3662d01d733ea6a32a4d41acedc6/.github/workflows/test.yml#L33 <https://github.com/opengisch/pzp/blob/ f951fa3fa4ae3662d01d733ea6a32a4d41acedc6/.github/workflows/test.yml#L33>El mar, 11 nov 2025 a las 5:06, Joona Laine via QGIS-Developer (<qgis- [email protected] <mailto:[email protected]>>) escribió:Hi, Are you using pytest-qgis already in your tests? If you are, just use the fixture qgis_processing in your tests and testing processing algorithms should work just fine. Check here for more details on how to easily test algorithms: https://github.com/GispoCoding/pytest- qgis/issues/27 <https://github.com/GispoCoding/pytest-qgis/issues/27> Cheers, Joona ti 11.11.2025 klo 11.09 Sergi Maspons - BGEO via QGIS-Developer ([email protected] <mailto:qgis- [email protected]>) kirjoitti: __ Hi all, I'm trying to build some CI tests on GitHub (with pytest) using the official qgis/qgis Docker image. Everything works fine except for the parts of my plugin that use Processing algorithms. I'd like to run full workflow tests, but the processing plugin doesn't seem to be available in the container. When I try to load it with qgis.utils.loadPlugin('processing') I get this error: Python error(2): Traceback (most recent call last): File "/usr/share/qgis/python/qgis/utils.py", line 447, in loadPlugin __import__(packageName) File "/usr/share/qgis/python/qgis/utils.py", line 1100, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'processing' Couldn't load plugin 'processing'(1): Couldn't load plugin 'processing' I can't find much documentation on how to build CI tests for a QGIS plugin, so I've been trying to make it work, but I don't know if I'm doing it rightly... I've tried installing extra packages (qgis-plugin-grass, grass, saga) in the Dockerfile, but it didn't help. Here's my *Dockerfile*: ARG QGIS_TEST_VERSION=latest FROM qgis/qgis: ${QGIS_TEST_VERSION} RUN apt-get update \ && apt-get install -y python3-pip qgis-plugin-grass grass saga \ && rm -rf / var/lib/apt/lists/* COPY ./test/requirements.txt /tmp/ RUN pip3 install --upgrade pip || true RUN pip3 install -r /tmp/ requirements.txt || pip3 install -r /tmp/requirements.txt -- break-system-packages ENV LANG=C.UTF-8 WORKDIR / This is my *run-docker-tests.sh*: #!/usr/bin/env bash set -e pushd /usr/src/ibergis_qgis_plugin xvfb-run pytest popd And the relevant part of *GitHub Actions (test.yml)*:# Run unit tests tests-qgis: runs-on: ubuntu-24.04 strategy: fail-fast: false matrix: qgis_version: [latest, ltr, stable] env: QGIS_TEST_VERSION: ${{ matrix.qgis_version }} steps: - name: Checkout uses: actions/checkout@v4 with: submodules: recursive - name: Test run: |chmod +x .docker/run-docker-tests.sh docker compose -f .docker/docker-compose.yml run qgis /usr/src/ ibergis_qgis_plugin/.docker/run-docker-tests.sh I haven't found much documentation on running QGIS plugin tests in CI environments, so I might be missing something obvious. If anyone has experience running tests that use Processing algorithms inside Docker, I'd really appreciate some guidance. Thanks in advance!-- *Sergi Maspons "Maspi"*_______________________________________________ QGIS-Developer mailing list [email protected] <mailto:QGIS- [email protected]> List info: https://lists.osgeo.org/mailman/listinfo/qgis- developer <https://lists.osgeo.org/mailman/listinfo/qgis-developer> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis- developer <https://lists.osgeo.org/mailman/listinfo/qgis-developer> _______________________________________________ QGIS-Developer mailing list [email protected] <mailto:[email protected]> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer <https://lists.osgeo.org/mailman/listinfo/qgis-developer> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer <https://lists.osgeo.org/mailman/listinfo/qgis-developer> _______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
-- Dr. Benjamin JakimowEarth Observation Lab | Geography Department | Humboldt-Universität zu Berlin
e-mail: [email protected] phone: +49 (0) 30 2093 45846 mobile: +49 (0) 157 5656 8477 fax: +49 (0) 30 2093 6848 mail: Unter den Linden 6 | 10099 Berlin | Germany matrix: @jakimowb:hu-berlin.de web: https://hu-berlin.de/eo-lab
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
