[QGIS-Developer] QgsProject.instance() in QGIS docker 3.10 crash

Etienne Trimaille etienne.trimaille at gmail.com
Tue Mar 17 09:00:25 PDT 2020


Hi,

I have setup some plugins with unittests using Docker.
I have followed the documentation :
https://github.com/qgis/QGIS/tree/master/.docker
to run them locally or/and on Travis.

This tests is working well using the QGIS 3.4 docker image :

class TestEditionDialog(unittest.TestCase):

    def test_atlas_dialog(self):
        """Test atlas dialog."""
        layer = QgsVectorLayer(plugin_test_data_path('lines.geojson'),
'lines', 'ogr')
        QgsProject.instance().addMapLayer(layer)
        self.assertTrue(layer.isValid())

But as soon as I start using a QGIS 3.10 docker image, QGIS crash.

test_atlas_dialog (lizmap.test.test_dialog_edition.TestEditionDialog)
Test atlas dialog. ... QGIS died on signal 11Test atlas dialog. ... QGIS
died on signal 11
Finished running test
qgis_plugin_tools.infrastructure.test_runner.test_package (codes: IS_DEAD=0
IS_FAILED=1 IS_PASSED=1).
root at 1c7939c428c6:/tests_directory/lizmap#

By commenting the code, I noticed it's the `QgsProject.instance()` which
trigger the crash.
It tried quickly to replace by:

        layer = QgsVectorLayer(plugin_test_data_path('lines.geojson'),
'lines', 'ogr')
        project = QgsProject()
        project.addMapLayer(layer)
        self.assertTrue(layer.isValid())

It's working, the test is OK. But then, all my tests using a
QgsMapLayerComboBox are failing because the combobox is empty.

Does anyone confirm this kind of behaviour in their tests? Is-it a bug or
is-it another way to do tests using this docker image?

Regards,
Etienne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200317/ade74bcf/attachment.html>


More information about the QGIS-Developer mailing list