From 86fde24cf45dfc59bf25f4fdd540d664962b344b Mon Sep 17 00:00:00 2001 From: Guilherme Martins Crocetti <24530683+gmcrocetti@users.noreply.github.com> Date: Sun, 5 Jan 2025 17:51:04 -0300 Subject: [PATCH] refactor: rewrite test --- pandas/tests/io/test_sql.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pandas/tests/io/test_sql.py b/pandas/tests/io/test_sql.py index 06baf3f547c6d..dcd011df4b19b 100644 --- a/pandas/tests/io/test_sql.py +++ b/pandas/tests/io/test_sql.py @@ -2700,20 +2700,20 @@ def test_drop_table(conn, request): assert not insp.has_table("temp_frame") -@pytest.mark.parametrize("conn", all_connectable) -def test_delete_rows_success(conn, test_frame1, request): +@pytest.mark.parametrize("conn_name", all_connectable) +def test_delete_rows_success(conn_name, test_frame1, request): table_name = "temp_frame" - conn = request.getfixturevalue(conn) - pandasSQL = pandasSQL_builder(conn) + conn = request.getfixturevalue(conn_name) - with pandasSQL.run_transaction(): - assert pandasSQL.to_sql(test_frame1, table_name) == test_frame1.shape[0] + with pandasSQL_builder(conn) as pandasSQL: + with pandasSQL.run_transaction(): + assert pandasSQL.to_sql(test_frame1, table_name) == test_frame1.shape[0] - with pandasSQL.run_transaction(): - assert pandasSQL.delete_rows(table_name) is None + with pandasSQL.run_transaction(): + assert pandasSQL.delete_rows(table_name) is None - assert count_rows(conn, table_name) == 0 - assert pandasSQL.has_table("temp_frame") + assert count_rows(conn, table_name) == 0 + assert pandasSQL.has_table("temp_frame") @pytest.mark.parametrize("conn_name", all_connectable)