@@ -329,6 +329,41 @@ def test_executemany_mysqlconnector_integration_comment(self):
329329 r"Select 1 /\*db_driver='mysql.connector%%3A1.2.3',dbapi_threadsafety=123,driver_paramstyle='test',mysql_client_version='1.2.3',traceparent='\d{1,2}-[a-zA-Z0-9_]{32}-[a-zA-Z0-9_]{16}-\d{1,2}'\*/;" ,
330330 )
331331
332+ @mock .patch ("opentelemetry.instrumentation.dbapi.util_version" )
333+ def test_executemany_mysqlclient_integration_comment (
334+ self ,
335+ mock_dbapi_util_version ,
336+ ):
337+ mock_dbapi_util_version .return_value = "1.2.3"
338+ connect_module = mock .MagicMock ()
339+ connect_module .__name__ = "MySQLdb"
340+ connect_module .__version__ = "1.2.3"
341+ connect_module .apilevel = 123
342+ connect_module .threadsafety = 123
343+ connect_module .paramstyle = "test"
344+ connect_module ._mysql = mock .MagicMock ()
345+ connect_module ._mysql .get_client_info = mock .MagicMock (
346+ return_value = "123"
347+ )
348+
349+ db_integration = dbapi .DatabaseApiIntegration (
350+ "testname" ,
351+ "mysql" ,
352+ enable_commenter = True ,
353+ commenter_options = {"db_driver" : True , "dbapi_level" : False },
354+ connect_module = connect_module ,
355+ )
356+
357+ mock_connection = db_integration .wrapped_connection (
358+ mock_connect , {}, {}
359+ )
360+ cursor = mock_connection .cursor ()
361+ cursor .executemany ("Select 1;" )
362+ self .assertRegex (
363+ cursor .query ,
364+ r"Select 1 /\*db_driver='MySQLdb%%3A1.2.3',dbapi_threadsafety=123,driver_paramstyle='test',mysql_client_version='123',traceparent='\d{1,2}-[a-zA-Z0-9_]{32}-[a-zA-Z0-9_]{16}-\d{1,2}'\*/;" ,
365+ )
366+
332367 def test_executemany_flask_integration_comment (self ):
333368 connect_module = mock .MagicMock ()
334369 connect_module .__name__ = "test"
0 commit comments