File tree 1 file changed +14
-0
lines changed
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -1527,6 +1527,20 @@ def test_con_string_import_error(self):
1527
1527
with pytest .raises (ImportError , match = "SQLAlchemy" ):
1528
1528
sql .read_sql ("SELECT * FROM iris" , conn )
1529
1529
1530
+ @pytest .mark .skipif (SQLALCHEMY_INSTALLED , reason = "SQLAlchemy is installed" )
1531
+ def test_con_unknown_dbapi2_class_does_not_error_without_sql_alchemy_installed (
1532
+ self ,
1533
+ ):
1534
+ class MockSqliteConnection :
1535
+ def __init__ (self , * args , ** kwargs ):
1536
+ self .conn = sqlite3 .Connection (* args , ** kwargs )
1537
+
1538
+ def __getattr__ (self , name ):
1539
+ return getattr (self .conn , name )
1540
+
1541
+ conn = MockSqliteConnection (":memory:" )
1542
+ sql .read_sql ("SELECT 1" , conn )
1543
+
1530
1544
def test_read_sql_delegate (self ):
1531
1545
iris_frame1 = sql .read_sql_query ("SELECT * FROM iris" , self .conn )
1532
1546
iris_frame2 = sql .read_sql ("SELECT * FROM iris" , self .conn )
You can’t perform that action at this time.
0 commit comments