@@ -1066,14 +1066,20 @@ def iris_connect_and_per_test_id(request, iris_path):
1066
1066
"conn_name" : conn_name ,
1067
1067
}
1068
1068
sqlalchemy = pytest .importorskip ("sqlalchemy" )
1069
- if type (conn ) == type ( " str" ):
1069
+ if isinstance (conn , str ):
1070
1070
conn = sqlalchemy .create_engine (conn )
1071
- drop_view (view_uuid , conn )
1072
- drop_table (table_uuid , conn )
1073
- if isinstance (conn , sqlalchemy .Engine ):
1071
+ drop_view (view_uuid , conn )
1072
+ drop_table (table_uuid , conn )
1074
1073
conn .dispose ()
1075
1074
else :
1076
- conn .close ()
1075
+ drop_view (view_uuid , conn )
1076
+ drop_table (table_uuid , conn )
1077
+ if isinstance (conn , sqlalchemy .Engine ):
1078
+ conn .dispose ()
1079
+ if isinstance (conn , sqlalchemy .Connection ):
1080
+ Engine = conn .engine
1081
+ conn .close ()
1082
+ Engine .dispose ()
1077
1083
1078
1084
1079
1085
@@ -1191,7 +1197,16 @@ def connect_and_uuid_types(request, types_data):
1191
1197
}
1192
1198
if isinstance (conn , str ):
1193
1199
conn = sqlalchemy .create_engine (conn )
1194
- drop_table_uuid_views (conn , table_uuid , view_uuid )
1200
+ drop_table_uuid_views (conn , table_uuid , view_uuid )
1201
+ conn .dispose ()
1202
+ else :
1203
+ drop_table_uuid_views (conn , table_uuid , view_uuid )
1204
+ if isinstance (conn , sqlalchemy .Engine ):
1205
+ conn .dispose ()
1206
+ if isinstance (conn , sqlalchemy .Connection ):
1207
+ Engine = conn .engine
1208
+ conn .close ()
1209
+ Engine .dispose ()
1195
1210
1196
1211
1197
1212
@pytest .fixture
@@ -1210,12 +1225,17 @@ def connect_and_uuid(request, types_data):
1210
1225
"conn_name" : conn_name ,
1211
1226
}
1212
1227
if isinstance (conn , str ):
1213
- sqlalchemy = pytest .importorskip ("sqlalchemy" )
1214
1228
conn = sqlalchemy .create_engine (conn )
1215
1229
drop_table_uuid_views (conn , table_uuid , view_uuid )
1216
1230
conn .dispose ()
1217
1231
else :
1218
1232
drop_table_uuid_views (conn , table_uuid , view_uuid )
1233
+ if isinstance (conn , sqlalchemy .Engine ):
1234
+ conn .dispose ()
1235
+ if isinstance (conn , sqlalchemy .Connection ):
1236
+ Engine = conn .engine
1237
+ conn .close ()
1238
+ Engine .dispose ()
1219
1239
1220
1240
1221
1241
0 commit comments