Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up the sqlite3 tests #93056

Merged
merged 1 commit into from May 21, 2022

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented May 21, 2022

Remove helper managed_connect(). Use memory_database() or contextlib.closing() + addCleanup(unlink) instead.

In #93047 (comment) @erlend-aasland noticed that the in_mem parameter is ill named. Indeed, the managed_connect() combines two functions: closing the Connection object and removing the file TESTFN. And in_mem=False parameter was used to suppress the later.

Actually, in most cases, memory_database() can be used instead. And in the leaving three cases where managed_connect() was used it is easy to get rid of it to unify the code.

Remove helper managed_connect(). Use memory_database() or
contextlib.closing() + addCleanup(unlink) instead.
Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

That's cleaner. Thanks!

@serhiy-storchaka serhiy-storchaka merged commit e5d8dbd into python:main May 21, 2022
12 checks passed
@miss-islington
Copy link
Contributor

miss-islington commented May 21, 2022

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒🤖

@bedevere-bot
Copy link

bedevere-bot commented May 21, 2022

GH-93058 is a backport of this pull request to the 3.11 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 21, 2022
Remove helper managed_connect(). Use memory_database() or
contextlib.closing() + addCleanup(unlink) instead.
(cherry picked from commit e5d8dbd)

Co-authored-by: Serhiy Storchaka <[email protected]>
miss-islington added a commit that referenced this pull request May 21, 2022
Remove helper managed_connect(). Use memory_database() or
contextlib.closing() + addCleanup(unlink) instead.
(cherry picked from commit e5d8dbd)

Co-authored-by: Serhiy Storchaka <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip issue skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants