Have testNestedInsert use an editable layer, making it idempotent

Also have it commit changes to avoid leaving cursors open
This commit is contained in:
Sandro Santilli 2021-10-07 20:57:03 +02:00
parent a3360965f6
commit 51d728b2bf

View File

@ -1146,13 +1146,15 @@ class TestPyQgsPostgresProvider(unittest.TestCase, ProviderTestCase):
def testNestedInsert(self):
tg = QgsTransactionGroup()
tg.addLayer(self.vl)
self.vl.startEditing()
it = self.vl.getFeatures()
l = self.getEditableLayer()
tg.addLayer(l)
l.startEditing()
it = l.getFeatures()
f = next(it)
f['pk'] = NULL
self.vl.addFeature(f) # Should not deadlock during an active iteration
self.assertTrue(l.addFeature(f)) # Should not deadlock during an active iteration
f = next(it)
l.commitChanges()
def testTimeout(self):
"""