3liz / pyqgisservercontrib-profiles

Profile management filters for py-qgis-server
Mozilla Public License 2.0
2 stars 1 forks source link

How to run the test suite #3

Open ptitjano opened 1 year ago

ptitjano commented 1 year ago

I tried to run the test with the command make test but it fails with the following log:

make -C tests/docker test-ows FLAVOR=3.28.7
make[1] : on entre dans le répertoire « /home/jean/dev/ifremer/pyqgisservercontrib-profiles/tests/docker »
mkdir -p $(pwd)/.local  $(pwd)/.cache $(pwd)/.workdir
Creating environment file for docker-compose
docker compose \
-f docker-compose.ows.yml up -V --quiet-pull --remove-orphans \
    --force-recreate --exit-code-from qgis-server
[+] Running 1/0
 ✔ Container test-pyqgisserver-profile-qgis-server-1  Recreated                                                                                                                                                0.0s 
Attaching to test-pyqgisserver-profile-qgis-server-1
test-pyqgisserver-profile-qgis-server-1  | -- HOME is /
test-pyqgisserver-profile-qgis-server-1  | -- Creating virtualenv
test-pyqgisserver-profile-qgis-server-1  | -- Installing server...
test-pyqgisserver-profile-qgis-server-1  | -- Installing required packages...
test-pyqgisserver-profile-qgis-server-1  | ImportError while loading conftest '/src/tests/unittests/conftest.py'.
test-pyqgisserver-profile-qgis-server-1  | conftest.py:5: in <module>
test-pyqgisserver-profile-qgis-server-1  |     from pyqgisserver.tests import TestRuntime
test-pyqgisserver-profile-qgis-server-1  | E   ModuleNotFoundError: No module named 'pyqgisserver'
test-pyqgisserver-profile-qgis-server-1 exited with code 4
Aborting on container exit...
[+] Stopping 1/0
 ✔ Container test-pyqgisserver-profile-qgis-server-1  Stopped                                                                                                                                                  0.0s 
make[1]: *** [Makefile:58 : ows-up] Erreur 4
make[1] : on quitte le répertoire « /home/jean/dev/ifremer/pyqgisservercontrib-profiles/tests/docker »
make: *** [Makefile:53 : test] Erreur 2

It looks like 'pyqgisserver is needed. What is the workflow to make it work ?

dmarteau commented 1 year ago

I'm surprised that you do not have the following warning from docker compose:

$ make -C tests/docker test-ows
make: Entering directory '/home/david/Projets/3liz/pyqgisservercontrib-profiles/tests/docker'
mkdir -p $(pwd)/.local  $(pwd)/.cache $(pwd)/.workdir
Creating environment file for docker-compose
docker compose \
-f docker-compose.ows.yml up -V --quiet-pull --remove-orphans \
    --force-recreate --exit-code-from qgis-server
WARN[0000] The "OWS_SERVER_SRC" variable is not set. Defaulting to a blank string. 
1 error(s) decoding:

* error decoding 'volumes[0]': invalid spec: :/server_src: empty section between colons
Makefile:58: recipe for target 'ows-up' failed
make: *** [ows-up] Error 15
make: Leaving directory '/home/david/Projets/3liz/pyqgisservercontrib-profiles/tests/docke
WARN[0000] The "OWS_SERVER_SRC" variable is not set. Defaulting to a blank string. 
1 error(s) decoding:
ptitjano commented 1 year ago

Thanks for the reply. I had defined OWS_SERVER_SRC as the path to pyqgiservercontrib instead of pyqgiserver. My bad.

It seems to work fine now. Maybe you could add some explanation in the README on how to launch the tests. This would make it easier to understand the usage of OWS_SERVER_SRC