File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525import sqlite3 as sqlite
2626import sys
2727
28+ from test .support import gc_collect
2829from test .support .os_helper import TESTFN , unlink
2930
3031
@@ -180,6 +181,8 @@ def __fspath__(self):
180181 path = Path ()
181182 with sqlite .connect (path ) as cx :
182183 cx .execute ('create table test(id integer)' )
184+ cx .close ()
185+ gc_collect ()
183186
184187 def test_open_uri (self ):
185188 self .addCleanup (unlink , TESTFN )
@@ -190,6 +193,8 @@ def test_open_uri(self):
190193 with sqlite .connect ('file:' + TESTFN + '?mode=ro' , uri = True ) as cx :
191194 with self .assertRaises (sqlite .OperationalError ):
192195 cx .execute ('insert into test(id) values(1)' )
196+ cx .close ()
197+ gc_collect ()
193198
194199
195200class StatementCacheTests (unittest .TestCase ):
Original file line number Diff line number Diff line change 2323import unittest
2424import sqlite3 as sqlite
2525
26+ from test .support import gc_collect
2627from test .support .os_helper import TESTFN , unlink
2728
2829
@@ -260,6 +261,9 @@ def trace(statement):
260261 con2 .execute ("create table bar(x)" )
261262 cur .execute (queries [1 ])
262263 self .assertEqual (traced_statements , queries )
264+ con1 .close ()
265+ con2 .close ()
266+ gc_collect ()
263267
264268
265269def suite ():
You can’t perform that action at this time.
0 commit comments