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 El mar, 11 nov 2025 a las 5:06, Joona Laine via QGIS-Developer (< [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 > > Cheers, > Joona > > ti 11.11.2025 klo 11.09 Sergi Maspons - BGEO via QGIS-Developer ( > [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] >> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer >> Unsubscribe: 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 >
_______________________________________________ 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
