[QGIS-Developer] Documentation tests failing on local machine
Richard Duivenvoorde
rdmailings at duif.net
Tue Aug 18 07:58:42 PDT 2020
Hi Matteo,
I have/had the same issue
Failed example:
iface = start_qgis()
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python3.8/doctest.py", line 1336, in __run
exec(compile(example.source, filename, "single",
File "<doctest composer (setup code)[1]>", line 1, in <module>
iface = start_qgis()
NameError: name 'start_qgis' is not defined
**********************************************************************
1 items had failures:
2 of 2 in composer (setup code)
***Test Failed*** 2 failures.
Exception occurred:
File "<string>", line 22, in <module>
ModuleNotFoundError: No module named 'qgis.testing'
But after A LOT of fiddling with my user.mk:
- adding a PYTHONPATH and a LD_LIBRARY_PATH
- adding my pythondir to the conf.py path: https://github.com/qgis/QGIS-Documentation/blob/master/conf.py#L317
it seemed I was able to run the tests... but fail:
Document: docs/pyqgis_developer_cookbook/network_analysis
---------------------------------------------------------
Logged warning: Duplicate provider native registered
ASSERT failure in QVector<T>::operator[]: "index out of range", file /usr/include/x86_64-linux-gnu/qt5/QtCore/qvector.h, line 459
make: *** [Makefile:43: doctest] Aborted
I see that the start_qgis is defined in the conf.py:
https://github.com/qgis/QGIS-Documentation/blob/1ec02b91b3321ae80a179b80a1a0a8508babcd9b/conf.py#L259
AND that Travis is still doing the tests, BUT using the docker image:
https://github.com/qgis/QGIS-Documentation/blob/1ec02b91b3321ae80a179b80a1a0a8508babcd9b/.travis.yml#L56
which is fine as it apparently is still (travis)happy...
So I think it is just a hell of a job to get your personal testing environment in place (especially if you have custom install dirs etc etc)..
Maybe best to use the docker test?
make -f docker.mk doctest
THAT one was running fine with me in the end...
Doctest summary
===============
306 tests
2 failures in tests
0 failures in setup code
0 failures in cleanup code
build finished with problems, 1 warning.
Makefile:43: recipe for target 'doctest' failed
make: *** [doctest] Error 1
make: *** [docker.mk:5: doctest] Error 2
So not sure what to do with this:
- tell everybody to use docker for this (easiest)
- create better documentation for everybody to setup it's environment (hard)...
Regards,
Richard Duivenvoorde
On 8/18/20 11:26 AM, matteo wrote:
> Hi all,
>
> I don't know what I'm doing wrong but when I run documentation tests on
> my local machine I always get messages like:
>
> **********************************************************************
> Line 6, in geometry (setup code)
> Failed example:
> iface = start_qgis()
>
> from qgis.core import (
> QgsProject,
> QgsVectorLayer,
> )
>
> # Load the countries layer
> if not QgsProject.instance().mapLayersByName("countries"):
> vlayer =
> QgsVectorLayer("/usr/share/qgis/resources/data/world_map.gpkg|layerName=countries",
> "countries", "ogr")
> assert vlayer.isValid()
> QgsProject.instance().addMapLayers([vlayer])
> Exception raised:
> Traceback (most recent call last):
> File "/usr/lib/python3.8/doctest.py", line 1336, in __run
> exec(compile(example.source, filename, "single",
> File "<doctest geometry (setup code)[1]>", line 1, in <module>
> iface = start_qgis()
> NameError: name 'start_qgis' is not defined
> **********************************************************************
> 1 items had failures:
> 2 of 2 in geometry (setup code)
> ***Test Failed*** 2 failures.
>
>
>
> I've QGIS compiled and I've added this lines in the user.mk file (in
> order to run test with a compiled version of QGIS instead of the default
> installation):
>
> # Root installation folder
> QGIS_PREFIX_PATH = /home/matteo/dev/qgis-master/output
>
> include venv.mk
>
> and run the following code
>
> make -f user.mk doctest
>
> I followed exactly the documentation
> (https://docs.qgis.org/testing/en/docs/documentation_guidelines/cookbook_guidelines.html#how-to-test-snippets-on-your-local-machine).
>
> I get the same exact errors also with the local installation of QGIS
> when running:
>
> make -f venv.mk doctest
>
> Some suggestions?
>
> Cheers and thanks!
>
> Matteo
>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
More information about the QGIS-Developer
mailing list