From 2b9717f2c1b74fb7a1ffe27eb89c1637f1355511 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Tue, 5 Oct 2021 23:09:58 +0200 Subject: [PATCH] Make TestPyQgsPostgresProvider.testPktUpdateBigintPk idempotent References #45417 --- tests/src/python/test_provider_postgres.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/src/python/test_provider_postgres.py b/tests/src/python/test_provider_postgres.py index c3334789dd10..dbdc08c84b30 100644 --- a/tests/src/python/test_provider_postgres.py +++ b/tests/src/python/test_provider_postgres.py @@ -720,6 +720,9 @@ def testPktUpdateBigintPk(self): "bigint_pk", "postgres") flds = vl.fields() + # Backup test table (will be edited) + self.backupTable('qgis_test', 'bigint_pk') + self.assertTrue(vl.isValid()) vl.startEditing() @@ -763,6 +766,9 @@ def testPktUpdateBigintPk(self): statuses[3] = 1 self.assertTrue(all(x == 1 for x in statuses)) + # Restore test table + self.restoreTable('qgis_test', 'bigint_pk') + def testPktUpdateBigintPkNonFirst(self): """Test if we can update objects with positive, zero and negative bigint PKs in tables whose PK is not the first field""" vl = QgsVectorLayer('{} sslmode=disable srid=4326 key="pk" table="qgis_test".{} (geom)'.format(self.dbconn,