Skip to content

Clean up the sqlite3 tests #93056

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

Merged
merged 1 commit into from
May 21, 2022

Conversation

serhiy-storchaka
Copy link
Member

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's cleaner. Thanks!

@miss-islington
Copy link
Contributor

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

@serhiy-storchaka serhiy-storchaka deleted the test-sqlite-cleanup branch May 21, 2022 16:06
@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label May 21, 2022
@bedevere-bot
Copy link

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.

4 participants