[QGIS-Developer] Documentation tests failing on local machine

matteo matteo.ghetta at gmail.com
Tue Aug 18 02:26:23 PDT 2020


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




More information about the QGIS-Developer mailing list