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
+ from test .support import LOOPBACK_TIMEOUT
27
+ from test .support .os_helper import TESTFN , unlink
28
+
26
29
from test .test_sqlite3 .test_dbapi import memory_database
27
30
28
- def get_db_path ():
29
- return "sqlite_testdb"
31
+
32
+ TIMEOUT = LOOPBACK_TIMEOUT / 10
33
+
30
34
31
35
class TransactionTests (unittest .TestCase ):
32
36
def setUp (self ):
33
- try :
34
- os .remove (get_db_path ())
35
- except OSError :
36
- pass
37
-
38
- self .con1 = sqlite .connect (get_db_path (), timeout = 0.1 )
37
+ self .con1 = sqlite .connect (TESTFN , timeout = TIMEOUT )
39
38
self .cur1 = self .con1 .cursor ()
40
39
41
- self .con2 = sqlite .connect (get_db_path () , timeout = 0.1 )
40
+ self .con2 = sqlite .connect (TESTFN , timeout = TIMEOUT )
42
41
self .cur2 = self .con2 .cursor ()
43
42
44
43
def tearDown (self ):
45
- self .cur1 .close ()
46
- self .con1 .close ()
44
+ try :
45
+ self .cur1 .close ()
46
+ self .con1 .close ()
47
47
48
- self .cur2 .close ()
49
- self .con2 .close ()
48
+ self .cur2 .close ()
49
+ self .con2 .close ()
50
50
51
- try :
52
- os .unlink (get_db_path ())
53
- except OSError :
54
- pass
51
+ finally :
52
+ unlink (TESTFN )
55
53
56
54
def test_dml_does_not_auto_commit_before (self ):
57
55
self .cur1 .execute ("create table test(i)" )
You can’t perform that action at this time.
0 commit comments