Skip to content

Commit

Permalink
Revert "Make test more exhaustive"
Browse files Browse the repository at this point in the history
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 d80ebab
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions tests/src/python/test_qgsdataitem.py
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d80ebab

Please sign in to comment.