From b60c73ff7d84cf973b714b773aac593a02fed2ef Mon Sep 17 00:00:00 2001 From: Jorrit Sandbrink Date: Sat, 14 Dec 2024 11:43:53 +0400 Subject: [PATCH] remove unnecessary context closing and opening --- tests/load/filesystem/test_sql_client.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/load/filesystem/test_sql_client.py b/tests/load/filesystem/test_sql_client.py index 7025ef0e18..a9d48080eb 100644 --- a/tests/load/filesystem/test_sql_client.py +++ b/tests/load/filesystem/test_sql_client.py @@ -101,11 +101,11 @@ def arrow_all_types(): DuckDbCredentials, ) - # check we can create new tables from the views with pipeline.sql_client() as c: # check if all data types are handled properly c.execute_sql("SELECT * FROM arrow_all_types;") + # check we can create new tables from the views c.execute_sql( "CREATE TABLE items_joined AS (SELECT i.id, di.double_id FROM items as i JOIN" " double_items as di ON (i.id = di.id));" @@ -117,16 +117,14 @@ def arrow_all_types(): assert list(joined_table[5]) == [5, 10] assert list(joined_table[10]) == [10, 20] - # inserting values into a view should fail gracefully - with pipeline.sql_client() as c: + # inserting values into a view should fail gracefully try: c.execute_sql("INSERT INTO double_items VALUES (1, 2)") except Exception as exc: assert "double_items is not an table" in str(exc) - # check that no automated views are created for a schema different than - # the known one - with pipeline.sql_client() as c: + # check that no automated views are created for a schema different than + # the known one c.execute_sql("CREATE SCHEMA other_schema;") with pytest.raises(DatabaseUndefinedRelation): with c.execute_query("SELECT * FROM other_schema.items ORDER BY id ASC;") as cursor: