diff --git a/pandas/tests/io/test_sql.py b/pandas/tests/io/test_sql.py index 06baf3f547c6d8..dcd011df4b19b8 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)