File tree Expand file tree Collapse file tree 1 file changed +15
-17
lines changed Expand file tree Collapse file tree 1 file changed +15
-17
lines changed Original file line number Diff line number Diff line change 2323import os , unittest
2424import sqlite3 as sqlite
2525
26+ from test .support import LOOPBACK_TIMEOUT
27+ from test .support .os_helper import TESTFN , unlink
28+
2629from test .test_sqlite3 .test_dbapi import memory_database
2730
28- def get_db_path ():
29- return "sqlite_testdb"
31+
32+ TIMEOUT = LOOPBACK_TIMEOUT / 10
33+
3034
3135class TransactionTests (unittest .TestCase ):
3236 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 )
3938 self .cur1 = self .con1 .cursor ()
4039
41- self .con2 = sqlite .connect (get_db_path () , timeout = 0.1 )
40+ self .con2 = sqlite .connect (TESTFN , timeout = TIMEOUT )
4241 self .cur2 = self .con2 .cursor ()
4342
4443 def tearDown (self ):
45- self .cur1 .close ()
46- self .con1 .close ()
44+ try :
45+ self .cur1 .close ()
46+ self .con1 .close ()
4747
48- self .cur2 .close ()
49- self .con2 .close ()
48+ self .cur2 .close ()
49+ self .con2 .close ()
5050
51- try :
52- os .unlink (get_db_path ())
53- except OSError :
54- pass
51+ finally :
52+ unlink (TESTFN )
5553
5654 def test_dml_does_not_auto_commit_before (self ):
5755 self .cur1 .execute ("create table test(i)" )
You can’t perform that action at this time.
0 commit comments