Skip to content

Commit 496b30c

Browse files
committed
refactor: rewrite test
1 parent 459dcc9 commit 496b30c

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

pandas/tests/io/test_sql.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -2700,20 +2700,20 @@ def test_drop_table(conn, request):
27002700
assert not insp.has_table("temp_frame")
27012701

27022702

2703-
@pytest.mark.parametrize("conn", all_connectable)
2704-
def test_delete_rows_success(conn, test_frame1, request):
2703+
@pytest.mark.parametrize("conn_name", all_connectable)
2704+
def test_delete_rows_success(conn_name, test_frame1, request):
27052705
table_name = "temp_frame"
2706-
conn = request.getfixturevalue(conn)
2707-
pandasSQL = pandasSQL_builder(conn)
2706+
conn = request.getfixturevalue(conn_name)
27082707

2709-
with pandasSQL.run_transaction():
2710-
assert pandasSQL.to_sql(test_frame1, table_name) == test_frame1.shape[0]
2708+
with pandasSQL_builder(conn) as pandasSQL:
2709+
with pandasSQL.run_transaction():
2710+
assert pandasSQL.to_sql(test_frame1, table_name) == test_frame1.shape[0]
27112711

2712-
with pandasSQL.run_transaction():
2713-
assert pandasSQL.delete_rows(table_name) is None
2712+
with pandasSQL.run_transaction():
2713+
assert pandasSQL.delete_rows(table_name) is None
27142714

2715-
assert count_rows(conn, table_name) == 0
2716-
assert pandasSQL.has_table("temp_frame")
2715+
assert count_rows(conn, table_name) == 0
2716+
assert pandasSQL.has_table("temp_frame")
27172717

27182718

27192719
@pytest.mark.parametrize("conn_name", all_connectable)

0 commit comments

Comments
 (0)