diff options
author | Erlend Egeberg Aasland <erlend.aasland@innova.no> | 2021-09-21 15:15:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-21 06:15:54 -0700 |
commit | 3e3ff09058a71b92c32d1d7dc32470c0cf49300c (patch) | |
tree | 10016af6d95732c5ed9799513dfd909ea13fe9ee /Lib/sqlite3/test/test_dbapi.py | |
parent | 050d1035957379d70e8601e6f5636637716a264b (diff) | |
download | cpython-git-3e3ff09058a71b92c32d1d7dc32470c0cf49300c.tar.gz |
bpo-44958: Fix ref. leak introduced in GH-27844 (GH-28490)
Modify managed_connect() helper to support in-memory databases. Use it
for the regression tests added in GH-27844.
Automerge-Triggered-By: GH:pablogsal
Diffstat (limited to 'Lib/sqlite3/test/test_dbapi.py')
-rw-r--r-- | Lib/sqlite3/test/test_dbapi.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/sqlite3/test/test_dbapi.py b/Lib/sqlite3/test/test_dbapi.py index 34cadeebfa..732e21dd3a 100644 --- a/Lib/sqlite3/test/test_dbapi.py +++ b/Lib/sqlite3/test/test_dbapi.py @@ -38,13 +38,14 @@ from test.support.os_helper import TESTFN, unlink, temp_dir # Helper for tests using TESTFN @contextlib.contextmanager -def managed_connect(*args, **kwargs): +def managed_connect(*args, in_mem=False, **kwargs): cx = sqlite.connect(*args, **kwargs) try: yield cx finally: cx.close() - unlink(TESTFN) + if not in_mem: + unlink(TESTFN) class ModuleTests(unittest.TestCase): |