diff --git a/tests/src/python/test_provider_postgres.py b/tests/src/python/test_provider_postgres.py index d63a0ceb890b..6e010b26b928 100644 --- a/tests/src/python/test_provider_postgres.py +++ b/tests/src/python/test_provider_postgres.py @@ -554,9 +554,7 @@ def testGeneratedFields(self): if pgversion < 120000: return - # Backup test table (will be edited) - self.execSQLCommand('DROP TABLE IF EXISTS qgis_test.test_gen_col_edit CASCADE') - self.execSQLCommand('CREATE TABLE qgis_test.test_gen_col_edit AS SELECT id,name,geom FROM qgis_test.test_gen_col') + scopedBackup1 = self.scopedTableBackup('qgis_test', 'test_gen_col') # Geometry columns vl = QgsVectorLayer('{} table="qgis_test"."{}" (geom) srid=4326 type=POLYGON key="id" sql='.format(self.dbconn, "test_gen_col"), "test_gen_col", "postgres") @@ -655,11 +653,6 @@ def testGeneratedFields(self): assert compareWkt(generated_geometry, expected_geometry), "Geometry mismatch! Expected:\n{}\nGot:\n{}\n".format(expected_geometry, generated_geometry) self.assertEqual(f4['poly_area'], expected_area) - # Restore test table (after editing it) - self.execSQLCommand('TRUNCATE TABLE qgis_test.test_gen_col') - self.execSQLCommand('INSERT INTO qgis_test.test_gen_col(id,name,geom) SELECT id,name,geom FROM qgis_test.test_gen_col_edit') - self.execSQLCommand('DROP TABLE qgis_test.test_gen_col_edit') - def testNonPkBigintField(self): """Test if we can correctly insert, read and change attributes(fields) of type bigint and which are not PKs.""" vl = QgsVectorLayer(