mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Clean up the sqlite3 tests (GH-93056)
Remove helper managed_connect(). Use memory_database() or contextlib.closing() + addCleanup(unlink) instead.
This commit is contained in:
parent
f9d6c59917
commit
e5d8dbdd30
2 changed files with 23 additions and 33 deletions
|
@ -28,7 +28,7 @@ import functools
|
|||
|
||||
from test import support
|
||||
from unittest.mock import patch
|
||||
from test.test_sqlite3.test_dbapi import memory_database, managed_connect, cx_limit
|
||||
from test.test_sqlite3.test_dbapi import memory_database, cx_limit
|
||||
|
||||
|
||||
class RegressionTests(unittest.TestCase):
|
||||
|
@ -422,7 +422,7 @@ class RegressionTests(unittest.TestCase):
|
|||
self.assertEqual(val, b'')
|
||||
|
||||
def test_table_lock_cursor_replace_stmt(self):
|
||||
with managed_connect(":memory:", in_mem=True) as con:
|
||||
with memory_database() as con:
|
||||
cur = con.cursor()
|
||||
cur.execute("create table t(t)")
|
||||
cur.executemany("insert into t values(?)",
|
||||
|
@ -433,7 +433,7 @@ class RegressionTests(unittest.TestCase):
|
|||
con.commit()
|
||||
|
||||
def test_table_lock_cursor_dealloc(self):
|
||||
with managed_connect(":memory:", in_mem=True) as con:
|
||||
with memory_database() as con:
|
||||
con.execute("create table t(t)")
|
||||
con.executemany("insert into t values(?)",
|
||||
((v,) for v in range(5)))
|
||||
|
@ -444,7 +444,7 @@ class RegressionTests(unittest.TestCase):
|
|||
con.commit()
|
||||
|
||||
def test_table_lock_cursor_non_readonly_select(self):
|
||||
with managed_connect(":memory:", in_mem=True) as con:
|
||||
with memory_database() as con:
|
||||
con.execute("create table t(t)")
|
||||
con.executemany("insert into t values(?)",
|
||||
((v,) for v in range(5)))
|
||||
|
@ -459,7 +459,7 @@ class RegressionTests(unittest.TestCase):
|
|||
con.commit()
|
||||
|
||||
def test_executescript_step_through_select(self):
|
||||
with managed_connect(":memory:", in_mem=True) as con:
|
||||
with memory_database() as con:
|
||||
values = [(v,) for v in range(5)]
|
||||
with con:
|
||||
con.execute("create table t(t)")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue