Skip to content

Commit 6cb435b

Browse files
author
Erlend E. Aasland
committed
Split open tests into their own test case, and cleanup more explicitly
1 parent 70511f3 commit 6cb435b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Lib/sqlite3/test/dbapi.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,16 @@ def test_in_transaction_ro(self):
170170
with self.assertRaises(AttributeError):
171171
self.cx.in_transaction = True
172172

173+
174+
class OpenTests(unittest.TestCase):
175+
def tearDown(self):
176+
import gc
177+
gc.collect()
178+
unlink(TESTFN)
179+
173180
def test_open_with_path_like_object(self):
174181
""" Checks that we can successfully connect to a database using an object that
175182
is PathLike, i.e. has __fspath__(). """
176-
self.addCleanup(unlink, TESTFN)
177183
class Path:
178184
def __fspath__(self):
179185
return TESTFN
@@ -182,7 +188,6 @@ def __fspath__(self):
182188
cx.execute('create table test(id integer)')
183189

184190
def test_open_uri(self):
185-
self.addCleanup(unlink, TESTFN)
186191
with sqlite.connect(TESTFN) as cx:
187192
cx.execute('create table test(id integer)')
188193
with sqlite.connect('file:' + TESTFN, uri=True) as cx:
@@ -942,6 +947,7 @@ def suite():
942947
CursorTests,
943948
ExtensionTests,
944949
ModuleTests,
950+
OpenTests,
945951
SqliteOnConflictTests,
946952
ThreadTests,
947953
]

0 commit comments

Comments
 (0)