[Qgis-developer] Updates to tests

Matthias Kuhn matthias at opengis.ch
Fri Feb 5 02:28:23 PST 2016


The processing plugin received a test suite which runs algorithms as
part of the CI process.

With this a number of changes have been introduced.


qgis.testing module
*******************

This is a new python module which should be shipped with QGIS. It
already contains some small bits of code interesting for every plugin
developer who wants to build his own unittests.

E.g.

    from qgis.testing.mocked import get_iface
    self.iface = get_iface()

The iface created this way contains all methods that the current QGIS'
iface defines (automagically). It also returns a valid mapCanvas().
Other methods do nothing, but you can e.g. check if a method has been
called and make it do some other things (see
https://docs.python.org/dev/library/unittest.mock.html )

If there is a change you think is valuable for everyone. e.g. You make
it return a real messageBar, please provide this code upstream, so we
can maintain one single copy of the mock iface code!

You can also provide more utils which are interesting for any QGIS
related python tests there.

Please keep methods which are only interesting for core QGIS python
tests in tests/src/python/utilities.py like before. These do not need to
be made public.

Dependencies
**************

nose2 has been introduced as testing dependency. It was the only library
I found which allos inheriting unittest.TestCase and writing test
generators at the same time. Along with pyyaml and mock modules.

processing
***********

Please participate in increasing the coverage of the processing test
suite. I wrote a blog post about it.

http://www.opengis.ch/2016/02/04/increasing-the-stability-of-processing-algorithms/

Cheers
Matthias

-- 
Matthias Kuhn
OPENGIS.ch - https://www.opengis.ch
Spatial • (Q)GIS • PostGIS • Open Source


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160205/57f113f2/attachment.sig>


More information about the Qgis-developer mailing list