Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Have testNestedInsert use an editable layer, making it idempotent
Also have it commit changes to avoid leaving cursors open
  • Loading branch information
strk committed Oct 13, 2021
1 parent a336096 commit 51d728b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/src/python/test_provider_postgres.py
Expand Up @@ -1146,13 +1146,15 @@ def onError(message):

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):
"""
Expand Down

0 comments on commit 51d728b

Please sign in to comment.