<div dir="ltr"><div dir="ltr">Hi Sergi,<div><br></div><div>I think I faced the same issue earlier this year.</div><div><br></div><div>Have a look at our test.yaml file [1], we needed to pass PYTHONPATH to the docker run command.</div><div><br></div><div>Hope that helps.</div><div><br></div><div>Regards,</div><div><br></div><div>Germán</div><div>-----------</div><div>[1] <a href="https://github.com/opengisch/pzp/blob/f951fa3fa4ae3662d01d733ea6a32a4d41acedc6/.github/workflows/test.yml#L33">https://github.com/opengisch/pzp/blob/f951fa3fa4ae3662d01d733ea6a32a4d41acedc6/.github/workflows/test.yml#L33</a></div><div><br></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">El mar, 11 nov 2025 a las 5:06, Joona Laine via QGIS-Developer (<<a href="mailto:qgis-developer@lists.osgeo.org">qgis-developer@lists.osgeo.org</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>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: <a href="https://github.com/GispoCoding/pytest-qgis/issues/27" target="_blank">https://github.com/GispoCoding/pytest-qgis/issues/27</a></div><div><br></div><div>Cheers,</div><div>Joona</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">ti 11.11.2025 klo 11.09 Sergi Maspons - BGEO via QGIS-Developer (<a href="mailto:qgis-developer@lists.osgeo.org" target="_blank">qgis-developer@lists.osgeo.org</a>) kirjoitti:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div>
<p>Hi all,</p>
<p>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.</p>
<p>When I try to load it with qgis.utils.loadPlugin('processing') I
get this error:<br>
</p>
<pre><font size="1">Python error(2): Traceback (most recent call last):</font>
<font size="1"> File "/usr/share/qgis/python/qgis/utils.py", line 447, in loadPlugin</font>
<font size="1"> __import__(packageName)</font>
<font size="1"> File "/usr/share/qgis/python/qgis/utils.py", line 1100, in _import</font>
<font size="1"> mod = _builtin_import(name, globals, locals, fromlist, level)</font>
<font size="1"> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</font>
<font size="1">ModuleNotFoundError: No module named 'processing'</font>
<font size="1">Couldn't load plugin 'processing'(1): Couldn't load plugin 'processing'</font></pre>
<p>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...</p>
<p>I've tried installing extra packages (qgis-plugin-grass, grass,
saga) in the Dockerfile, but it didn't help.</p>
<p>Here's my <b>Dockerfile</b>:<br>
</p>
<pre><font size="2">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 /</font></pre>
<p>This is my <b>run-docker-tests.sh</b>:<br>
</p>
<pre><font size="2">#!/usr/bin/env bash
set -e
pushd /usr/src/ibergis_qgis_plugin
xvfb-run pytest
popd</font></pre>
<p>And the relevant part of <b>GitHub Actions (test.yml)</b>:<br>
</p>
<pre><font size="2"> # 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</font></pre>
<p>I haven't found much documentation on running QGIS plugin tests
in CI environments, so I might be missing something obvious.<br>
If anyone has experience running tests that use Processing
algorithms inside Docker, I'd really appreciate some guidance.</p>
<p>Thanks in advance!</p>
<div>-- <br>
<div><b>Sergi Maspons "Maspi"</b><br>
</div>
</div>
</div>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div><div><br clear="all"></div><div><br></div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div></div></div></div></div></div></div></div></div></div>