mirror of
https://github.com/python/cpython.git
synced 2025-09-07 01:11:26 +00:00
gh-105539: Fix ResourceWarning from unclosed SQLite connections in test_sqlite3 (#108360)
Follow up to 1a1bfc2891
.
Explicitly manage connections in:
- test_audit.test_sqlite3
- test_sqlite3.test_audit
- test_sqlite3.test_backup
Co-authored-by: Erlend E. Aasland <erlend@python.org>
This commit is contained in:
parent
31b61d19ab
commit
29bc6165ab
3 changed files with 16 additions and 13 deletions
|
@ -40,6 +40,7 @@ from os import SEEK_SET, SEEK_CUR, SEEK_END
|
|||
from test.support.os_helper import TESTFN, TESTFN_UNDECODABLE, unlink, temp_dir, FakePath
|
||||
|
||||
from .util import memory_database, cx_limit
|
||||
from .util import MemoryDatabaseMixin
|
||||
|
||||
|
||||
class ModuleTests(unittest.TestCase):
|
||||
|
@ -1740,10 +1741,9 @@ class ClosedConTests(unittest.TestCase):
|
|||
self.check(self.con)
|
||||
|
||||
|
||||
class ClosedCurTests(unittest.TestCase):
|
||||
class ClosedCurTests(MemoryDatabaseMixin, unittest.TestCase):
|
||||
def test_closed(self):
|
||||
con = sqlite.connect(":memory:")
|
||||
cur = con.cursor()
|
||||
cur = self.cx.cursor()
|
||||
cur.close()
|
||||
|
||||
for method_name in ("execute", "executemany", "executescript", "fetchall", "fetchmany", "fetchone"):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue