[Qgis-user] How do people unit test plugin code?

Ian Turton ijturton at gmail.com
Thu Sep 24 00:36:38 PDT 2020


I was toying with refactoring my plugin code the other day, but I thought I
would add some unit tests using pytest before I started to make sure I
didn't break anything. But when I try something like:

def test_convertGridRef():
     QgsExpression.registerFunction(convertGridRef)
     e = QgsExpression('convertGridRef("SE2720")')
     assert e.evaluate(None) == 'POINT (427000 420000)'

e.evaluate returns None - when it should either return a point or an
exception

Does anyone have some good plugin unit test examples I can take a look at?

Thanks

Ian
-- 
Ian Turton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20200924/645f86b3/attachment.html>


More information about the Qgis-user mailing list