@@ -326,11 +326,12 @@ def test_load_instrumentors_dep_conflict(self, iter_mock, mock_logger):  # pylin
326326            ]
327327        )
328328
329+     @patch ("opentelemetry.instrumentation.auto_instrumentation._load._logger" ) 
329330    @patch ( 
330331        "opentelemetry.instrumentation.auto_instrumentation._load.entry_points"  
331332    ) 
332333    def  test_load_instrumentors_import_error_does_not_stop_everything (
333-         self , iter_mock 
334+         self , iter_mock ,  mock_logger 
334335    ):
335336        ep_mock1  =  Mock (name = "instr1" )
336337        ep_mock2  =  Mock (name = "instr2" )
@@ -354,6 +355,12 @@ def test_load_instrumentors_import_error_does_not_stop_everything(
354355            ]
355356        )
356357        self .assertEqual (distro_mock .load_instrumentor .call_count , 2 )
358+         mock_logger .exception .assert_any_call (
359+             "Importing of %s failed, skipping it" ,
360+             ep_mock1 .name ,
361+         )
362+ 
363+         mock_logger .debug .assert_any_call ("Instrumented %s" , ep_mock2 .name )
357364
358365    @patch ( 
359366        "opentelemetry.instrumentation.auto_instrumentation._load.entry_points"  
@@ -422,39 +429,6 @@ def test_load_instrumentors_module_not_found_error(
422429
423430        mock_logger .debug .assert_any_call ("Instrumented %s" , ep_mock2 .name )
424431
425-     @patch ("opentelemetry.instrumentation.auto_instrumentation._load._logger" ) 
426-     @patch ( 
427-         "opentelemetry.instrumentation.auto_instrumentation._load.entry_points"  
428-     ) 
429-     def  test_load_instrumentors_import_error (self , iter_mock , mock_logger ):
430-         ep_mock1  =  Mock ()
431-         ep_mock1 .name  =  "instr1" 
432- 
433-         ep_mock2  =  Mock ()
434-         ep_mock2 .name  =  "instr2" 
435- 
436-         distro_mock  =  Mock ()
437-         distro_mock .load_instrumentor .side_effect  =  [ImportError , None ]
438- 
439-         iter_mock .side_effect  =  [(), (ep_mock1 , ep_mock2 ), ()]
440- 
441-         _load ._load_instrumentors (distro_mock )
442- 
443-         distro_mock .load_instrumentor .assert_has_calls (
444-             [
445-                 call (ep_mock1 , raise_exception_on_conflict = True ),
446-                 call (ep_mock2 , raise_exception_on_conflict = True ),
447-             ]
448-         )
449-         self .assertEqual (distro_mock .load_instrumentor .call_count , 2 )
450- 
451-         mock_logger .exception .assert_any_call (
452-             "Importing of %s failed, skipping it" ,
453-             ep_mock1 .name ,
454-         )
455- 
456-         mock_logger .debug .assert_any_call ("Instrumented %s" , ep_mock2 .name )
457- 
458432    def  test_load_instrumentors_no_entry_point_mocks (self ):
459433        distro_mock  =  Mock ()
460434        _load ._load_instrumentors (distro_mock )
0 commit comments