3

I want to get unittesting under Travis to work with qgis2web. It works up to a point, but Python access within the plugin to the plugin's own UI seems not to be working. The unittest I am working on is here:

https://github.com/tomchadwin/qgis2web/blob/master/test/test_qgis2web_dialog.py#L86

An instance of the problem seems to be in populate_layers_and_groups():

https://github.com/tomchadwin/qgis2web/blob/master/maindialog.py#L133

The UI item layers_item is created here:

https://github.com/tomchadwin/qgis2web/blob/master/maindialog.py#L141

However, after this function should have added layers as children to this item, childCount() gives 0 in Travis:

https://github.com/tomchadwin/qgis2web/blob/master/maindialog.py#L175

Running the plugin in QGIS on my client gives the correct value for this childCount().

So, am I failing to pass a reference to, or inject, the plugin UI in the context of the unittest? If so, how do I fix it? If not, what is the issue?

  • I would like to thank you for your .travis.yml file, I wanted to have travis-ci unit test my plugin GhiniTreePositioner, too, and I did not know where to start. Now I do. thanks. – mariotomo Jan 11 '17 at 19:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.