Skip to content
Permalink
Browse files
Revert "Make test more exhaustive"
While this makes the test not crash on my machine, it does
the reverse on the GA workflow. Some sip nonsense is at
play here..
  • Loading branch information
nyalldawson committed May 27, 2021
1 parent d8f5de5 commit d80ebabd7d0f8b7835413902d355f056a4cfb42a
Showing with 5 additions and 14 deletions.
  1. +5 −14 tests/src/python/test_qgsdataitem.py
@@ -13,7 +13,6 @@

import os
from qgis.PyQt.QtCore import QEventLoop
from qgis.PyQt import sip
from qgis.core import QgsDataCollectionItem, QgsLayerItem, QgsDirectoryItem
from utilities import unitTestDataPath
from qgis.testing import start_app, unittest
@@ -66,26 +65,18 @@ def testPythonCreateChildrenCalledFromCplusplus(self):
# Python object PyQgsLayerItem should still be alive
self.assertFalse(tabSetDestroyedFlag[0])

self.assertTrue(item.hasChildren())
self.assertEqual(item.rowCount(), 2)
children = item.children()
self.assertEqual(len(children), 2)
self.assertEqual(children[0].name(), "name")
self.assertEqual(children[1].name(), "name2")

if i % 2 == 0:
# make the test a bit more exhaustive -- on every second run we don't eveb
# create any sip wrappers around the children
children = item.children()
self.assertEqual(len(children), 2)
self.assertEqual(children[0].name(), "name")
self.assertEqual(children[1].name(), "name2")
del(children)

# Delete the object and make sure all deferred deletions are processed
item.destroyed.connect(loop.quit)
item.deleteLater()
loop.exec_()

if i % 2 == 0:
self.assertTrue(sip.isdeleted(children[0]))
self.assertTrue(sip.isdeleted(children[1]))

# Check that the PyQgsLayerItem Python object is now destroyed
self.assertTrue(tabSetDestroyedFlag[0])
tabSetDestroyedFlag[0] = False

0 comments on commit d80ebab

Please sign in to comment.