File tree Expand file tree Collapse file tree 2 files changed +2
-15
lines changed Expand file tree Collapse file tree 2 files changed +2
-15
lines changed Original file line number Diff line number Diff line change 25
25
import sqlite3 as sqlite
26
26
import sys
27
27
28
- from test .support import gc_collect
29
28
from test .support .os_helper import TESTFN , unlink
30
29
31
30
@@ -171,16 +170,10 @@ def test_in_transaction_ro(self):
171
170
with self .assertRaises (AttributeError ):
172
171
self .cx .in_transaction = True
173
172
174
-
175
- class OpenTests (unittest .TestCase ):
176
- def tearDown (self ):
177
- # bpo-42213: ensure that TESTFN is closed before unlinking
178
- gc_collect ()
179
- unlink (TESTFN )
180
-
181
173
def test_open_with_path_like_object (self ):
182
174
""" Checks that we can successfully connect to a database using an object that
183
175
is PathLike, i.e. has __fspath__(). """
176
+ self .addCleanup (unlink , TESTFN )
184
177
class Path :
185
178
def __fspath__ (self ):
186
179
return TESTFN
@@ -189,6 +182,7 @@ def __fspath__(self):
189
182
cx .execute ('create table test(id integer)' )
190
183
191
184
def test_open_uri (self ):
185
+ self .addCleanup (unlink , TESTFN )
192
186
with sqlite .connect (TESTFN ) as cx :
193
187
cx .execute ('create table test(id integer)' )
194
188
with sqlite .connect ('file:' + TESTFN , uri = True ) as cx :
@@ -948,7 +942,6 @@ def suite():
948
942
CursorTests ,
949
943
ExtensionTests ,
950
944
ModuleTests ,
951
- OpenTests ,
952
945
SqliteOnConflictTests ,
953
946
ThreadTests ,
954
947
]
Original file line number Diff line number Diff line change 23
23
import unittest
24
24
import sqlite3 as sqlite
25
25
26
- from test .support import gc_collect
27
26
from test .support .os_helper import TESTFN , unlink
28
27
29
28
@@ -262,11 +261,6 @@ def trace(statement):
262
261
cur .execute (queries [1 ])
263
262
self .assertEqual (traced_statements , queries )
264
263
265
- # bpo-42213: ensure that TESTFN is closed before the cleanup runs
266
- con1 .close ()
267
- con2 .close ()
268
- gc_collect ()
269
-
270
264
271
265
def suite ():
272
266
tests = [
You can’t perform that action at this time.
0 commit comments