@@ -43,11 +43,12 @@ class TestQgsSpatialiteProvider(TestCase):
43
43
def setUpClass (cls ):
44
44
"""Run before all tests"""
45
45
# create test db
46
- cls .dbname = os .path .join ( tempfile .gettempdir (), "test.sqlite" )
46
+ cls .dbname = os .path .join ( tempfile .gettempdir (), "test.sqlite" )
47
47
if os .path .exists ( cls .dbname ):
48
48
os .remove ( cls .dbname )
49
- con = sqlite3 .connect (cls .dbname )
49
+ con = sqlite3 .connect (cls .dbname , isolation_level = None )
50
50
cur = con .cursor ()
51
+ cur .execute ( "BEGIN" )
51
52
sql = "SELECT InitSpatialMetadata()"
52
53
cur .execute (sql )
53
54
@@ -69,7 +70,7 @@ def setUpClass(cls):
69
70
sql += "VALUES (1, 'toto', GeomFromText('POLYGON((0 0,1 0,1 1,0 1,0 0))', 4326))"
70
71
cur .execute (sql )
71
72
72
- con . commit ( )
73
+ cur . execute ( "COMMIT" )
73
74
con .close ()
74
75
75
76
@classmethod
@@ -97,7 +98,7 @@ def test_SplitFeature(self):
97
98
layer .splitFeatures ([QgsPoint (0.5 , - 0.5 ), QgsPoint (0.5 , 1.5 )], 0 )== 0 or die ("error in split" )
98
99
layer .splitFeatures ([QgsPoint (- 0.5 , 0.5 ), QgsPoint (1.5 , 0.5 )], 0 )== 0 or die ("error in split" )
99
100
if not layer .commitChanges ():
100
- die ("this commit should work" )
101
+ die ("this commit should work" )
101
102
layer .featureCount () == 4 or die ("we should have 4 features after 2 split" )
102
103
103
104
def xtest_SplitFeatureWithFailedCommit (self ):
@@ -109,7 +110,7 @@ def xtest_SplitFeatureWithFailedCommit(self):
109
110
layer .splitFeatures ([QgsPoint (0.5 , - 0.5 ), QgsPoint (0.5 , 1.5 )], 0 )== 0 or die ("error in split" )
110
111
layer .splitFeatures ([QgsPoint (- 0.5 , 0.5 ), QgsPoint (1.5 , 0.5 )], 0 )== 0 or die ("error in split" )
111
112
if layer .commitChanges ():
112
- die ("this commit should fail" )
113
+ die ("this commit should fail" )
113
114
layer .rollBack ()
114
115
feat = QgsFeature ()
115
116
it = layer .getFeatures ()
0 commit comments