File tree 1 file changed +15
-17
lines changed
1 file changed +15
-17
lines changed Original file line number Diff line number Diff line change 23
23
import os , unittest
24
24
import sqlite3 as sqlite
25
25
26
- def get_db_path ():
27
- return "sqlite_testdb"
26
+ from test .support import LOOPBACK_TIMEOUT
27
+ from test .support .os_helper import TESTFN , unlink
28
+
29
+
30
+ TIMEOUT = LOOPBACK_TIMEOUT / 10
31
+
28
32
29
33
class TransactionTests (unittest .TestCase ):
30
34
def setUp (self ):
31
- try :
32
- os .remove (get_db_path ())
33
- except OSError :
34
- pass
35
-
36
- self .con1 = sqlite .connect (get_db_path (), timeout = 0.1 )
35
+ self .con1 = sqlite .connect (TESTFN , timeout = TIMEOUT )
37
36
self .cur1 = self .con1 .cursor ()
38
37
39
- self .con2 = sqlite .connect (get_db_path () , timeout = 0.1 )
38
+ self .con2 = sqlite .connect (TESTFN , timeout = TIMEOUT )
40
39
self .cur2 = self .con2 .cursor ()
41
40
42
41
def tearDown (self ):
43
- self .cur1 .close ()
44
- self .con1 .close ()
42
+ try :
43
+ self .cur1 .close ()
44
+ self .con1 .close ()
45
45
46
- self .cur2 .close ()
47
- self .con2 .close ()
46
+ self .cur2 .close ()
47
+ self .con2 .close ()
48
48
49
- try :
50
- os .unlink (get_db_path ())
51
- except OSError :
52
- pass
49
+ finally :
50
+ unlink (TESTFN )
53
51
54
52
def test_dml_does_not_auto_commit_before (self ):
55
53
self .cur1 .execute ("create table test(i)" )
You can’t perform that action at this time.
0 commit comments