GispoCoding/pytest-qgis

Add FAQ or troubleshooting section to README

Joonalai opened this issue · 0 comments

Expected behaviour
There are few pitfalls when testing QGIS plugins that might cause unexpected behaviours. Some of those are addressed in README but it would be great if there would be a whole section for those.

Some of the pitfalls:

  • Do not initialize QgsCoordinateReferenceSystem before QgsApplication is initialized. This could be a problem if this happens in the beginning of the conftest.py, See: #60.
  • Be careful not to import modules importing qgis.utils.iface in the root of conftest, because the pytest_configure hook has not yet patched iface in that point. See: #35
  • Use "layer", "lyr", "raster", "rast", "tif" in layer fixture names in order for those to be cleaned
  • In case proj.db could not be found, set PROJ_LIB environment variable to point to right location. See: #58

Additional context
Some of the pitfalls could be made as rules into flake8-qgis.