@@ -158,12 +158,17 @@ def test_connection_get_table_schema(duck_conn):
158158 ]
159159 )
160160
161+ # The schema/tables created above must survive the rollback below, so commit them first.
162+ duck_conn .commit ()
163+
161164 # Test invalid catalog name
162165 with pytest .raises (
163166 adbc_driver_manager .InternalError ,
164167 match = r'Catalog "bla" does not exist' ,
165168 ):
166169 duck_conn .adbc_get_table_schema ("tableschema" , catalog_filter = "bla" , db_schema_filter = "test" )
170+ # The failed lookup aborts the (autocommit-off) transaction; roll it back before continuing.
171+ duck_conn .rollback ()
167172
168173 # Catalog and DB Schema name
169174 assert duck_conn .adbc_get_table_schema (
@@ -214,13 +219,18 @@ def test_insertion(duck_conn):
214219 cursor .execute ("SELECT * FROM ingest" )
215220 assert cursor .fetch_arrow_table () == table
216221
222+ # The created tables must survive the rollback below, so commit them first.
223+ duck_conn .commit ()
224+
217225 # Test Append
218226 with duck_conn .cursor () as cursor :
219227 with pytest .raises (
220228 adbc_driver_manager .ProgrammingError ,
221229 match = r"ALREADY_EXISTS" ,
222230 ):
223231 cursor .adbc_ingest ("ingest_table" , table , "create" )
232+ # The failed create aborts the (autocommit-off) transaction; roll it back before continuing.
233+ duck_conn .rollback ()
224234 cursor .adbc_ingest ("ingest_table" , table , "append" )
225235 cursor .execute ("SELECT count(*) FROM ingest_table" )
226236 assert cursor .fetch_arrow_table ().to_pydict () == {"count_star()" : [8 ]}
0 commit comments