Skip to content

Commit

Permalink
refactor: rewrite test
Browse files Browse the repository at this point in the history
  • Loading branch information
gmcrocetti committed Jan 8, 2025
1 parent f346b85 commit 86fde24
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pandas/tests/io/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 86fde24

Please sign in to comment.