Skip to content

CLN Replace direct import of closing with qualified contextlib usage #61506

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 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions pandas/tests/io/test_sql.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

import contextlib
from contextlib import closing
import csv
from datetime import (
date,
Expand Down Expand Up @@ -2580,10 +2579,10 @@ def test_sql_open_close(test_frame3):
# between the writing and reading (as in many real situations).

with tm.ensure_clean() as name:
with closing(sqlite3.connect(name)) as conn:
with contextlib.closing(sqlite3.connect(name)) as conn:
assert sql.to_sql(test_frame3, "test_frame3_legacy", conn, index=False) == 4

with closing(sqlite3.connect(name)) as conn:
with contextlib.closing(sqlite3.connect(name)) as conn:
result = sql.read_sql_query("SELECT * FROM test_frame3_legacy;", conn)

tm.assert_frame_equal(test_frame3, result)
Expand Down
Loading