mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
gh-105539: Explict resource management for connection objects in sqlite3 tests (#108017)
- Use memory_database() helper - Move test utility functions to util.py - Add convenience memory database mixin - Add check() helper for closed connection tests
This commit is contained in:
parent
c9d83f93d8
commit
1344cfac43
9 changed files with 371 additions and 385 deletions
|
@ -2,16 +2,12 @@
|
|||
|
||||
import unittest
|
||||
import sqlite3 as sqlite
|
||||
from .test_dbapi import memory_database
|
||||
|
||||
from .util import memory_database
|
||||
from .util import MemoryDatabaseMixin
|
||||
|
||||
|
||||
class DumpTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.cx = sqlite.connect(":memory:")
|
||||
self.cu = self.cx.cursor()
|
||||
|
||||
def tearDown(self):
|
||||
self.cx.close()
|
||||
class DumpTests(MemoryDatabaseMixin, unittest.TestCase):
|
||||
|
||||
def test_table_dump(self):
|
||||
expected_sqls = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue