Skip to content

Commit f1f023b

Browse files
author
Erlend E. Aasland
committed
Fix tests on Windows
1 parent e02ec4c commit f1f023b

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Lib/sqlite3/test/dbapi.py

+5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import sqlite3 as sqlite
2626
import sys
2727

28+
from test.support import gc_collect
2829
from 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

195200
class StatementCacheTests(unittest.TestCase):

Lib/sqlite3/test/hooks.py

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import unittest
2424
import sqlite3 as sqlite
2525

26+
from test.support import gc_collect
2627
from 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

265269
def suite():

0 commit comments

Comments
 (0)