@@ -77,6 +77,15 @@ def test_mysql_pool_size():
7777 assert kwargs == {"minsize" : 1 , "maxsize" : 20 }
7878
7979
80+ @pytest .mark .skipif (sys .version_info >= (3 , 10 ), reason = "requires python3.9 or lower" )
81+ def test_mysql_unix_socket ():
82+ backend = MySQLBackend (
83+ "mysql+aiomysql://username:password@/testsuite?unix_socket=/tmp/mysqld/mysqld.sock"
84+ )
85+ kwargs = backend ._get_connection_kwargs ()
86+ assert kwargs == {"unix_socket" : "/tmp/mysqld/mysqld.sock" }
87+
88+
8089@pytest .mark .skipif (sys .version_info >= (3 , 10 ), reason = "requires python3.9 or lower" )
8190def test_mysql_explicit_pool_size ():
8291 backend = MySQLBackend ("mysql://localhost/database" , min_size = 1 , max_size = 20 )
@@ -114,6 +123,15 @@ def test_asyncmy_pool_size():
114123 assert kwargs == {"minsize" : 1 , "maxsize" : 20 }
115124
116125
126+ @pytest .mark .skipif (sys .version_info < (3 , 7 ), reason = "requires python3.7 or higher" )
127+ def test_asyncmy_unix_socket ():
128+ backend = AsyncMyBackend (
129+ "mysql+asyncmy://username:password@/testsuite?unix_socket=/tmp/mysqld/mysqld.sock"
130+ )
131+ kwargs = backend ._get_connection_kwargs ()
132+ assert kwargs == {"unix_socket" : "/tmp/mysqld/mysqld.sock" }
133+
134+
117135@pytest .mark .skipif (sys .version_info < (3 , 7 ), reason = "requires python3.7 or higher" )
118136def test_asyncmy_explicit_pool_size ():
119137 backend = AsyncMyBackend ("mysql://localhost/database" , min_size = 1 , max_size = 20 )
0 commit comments