[Qgis-developer] How to debug and unit test Python plugins outside QGIS (e.g. in Ecplise IDE + PyDev)

Stefan Keller sfkeller at gmail.com
Wed Mar 2 18:57:59 EST 2011


Hi,

I'm new to writing Python plugins for QGIS and I like to debug and
unit test theses outside QGIS runtime but don't see any instructions
on how to do this.

Of course, the ultimate test of any plugin is to run it inside QGIS.
But I'd like do that outside QGIS for example in Eclipse IDE (+ PyDev)
in order to get code-completion, to debug it and to write unit tests
on it.

The problem is that one gets "ImportError: No module named ..." with
mostly PyQt4/qgis modules which (of course) cannot be imported.

This post mentions "Forced builtin libs" and reports a similar
problem: http://www.osgeo.org/pipermail/qgis-developer/2010-February/009182.html
... and this PyDev documentation explains "Forced builtin libs" and
"Predefined completions":
http://pydev.org/manual_101_interpreter.html#id1

I can't imagine that I'm the first trying to debug and unit test
Python plugins for QGIS.

Can anybody give me a hand on this?

Yours, S.


More information about the Qgis-developer mailing list