Skip to content

Commit d80ebab

Browse files
committedMay 27, 2021
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..
1 parent d8f5de5 commit d80ebab

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed
 

‎tests/src/python/test_qgsdataitem.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

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

69-
self.assertTrue(item.hasChildren())
70-
self.assertEqual(item.rowCount(), 2)
68+
children = item.children()
69+
self.assertEqual(len(children), 2)
70+
self.assertEqual(children[0].name(), "name")
71+
self.assertEqual(children[1].name(), "name2")
7172

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

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

85-
if i % 2 == 0:
86-
self.assertTrue(sip.isdeleted(children[0]))
87-
self.assertTrue(sip.isdeleted(children[1]))
88-
8980
# Check that the PyQgsLayerItem Python object is now destroyed
9081
self.assertTrue(tabSetDestroyedFlag[0])
9182
tabSetDestroyedFlag[0] = False

0 commit comments

Comments
 (0)
Please sign in to comment.