1010from opentelemetry .instrumentation .kafka import KafkaInstrumentor
1111from opentelemetry .instrumentation .kafka .package import (
1212 _instruments_kafka_python ,
13- _instruments_kafka_python_ng ,
1413)
1514
1615
@@ -54,50 +53,6 @@ def _distribution(name):
5453 )
5554 self .assertEqual (package_to_instrument , (_instruments_kafka_python ,))
5655
57- @patch ("opentelemetry.instrumentation.kafka.distribution" )
58- def test_instrumentation_dependencies_kafka_python_ng_installed (
59- self , mock_distribution
60- ) -> None :
61- instrumentation = KafkaInstrumentor ()
62-
63- def _distribution (name ):
64- if name == "kafka-python-ng" :
65- return None
66- raise PackageNotFoundError
67-
68- mock_distribution .side_effect = _distribution
69- package_to_instrument = instrumentation .instrumentation_dependencies ()
70-
71- self .assertEqual (mock_distribution .call_count , 1 )
72- self .assertEqual (
73- mock_distribution .mock_calls , [call ("kafka-python-ng" )]
74- )
75- self .assertEqual (
76- package_to_instrument , (_instruments_kafka_python_ng ,)
77- )
78-
79- @patch ("opentelemetry.instrumentation.kafka.distribution" )
80- def test_instrumentation_dependencies_both_installed (
81- self , mock_distribution
82- ) -> None :
83- instrumentation = KafkaInstrumentor ()
84-
85- def _distribution (name ):
86- # The function returns None here for all names
87- # to simulate both packages being installed
88- return None
89-
90- mock_distribution .side_effect = _distribution
91- package_to_instrument = instrumentation .instrumentation_dependencies ()
92-
93- self .assertEqual (mock_distribution .call_count , 1 )
94- self .assertEqual (
95- mock_distribution .mock_calls , [call ("kafka-python-ng" )]
96- )
97- self .assertEqual (
98- package_to_instrument , (_instruments_kafka_python_ng ,)
99- )
100-
10156 @patch ("opentelemetry.instrumentation.kafka.distribution" )
10257 def test_instrumentation_dependencies_none_installed (
10358 self , mock_distribution
@@ -122,7 +77,4 @@ def _distribution(name):
12277 call ("kafka-python" ),
12378 ],
12479 )
125- self .assertEqual (
126- package_to_instrument ,
127- (_instruments_kafka_python , _instruments_kafka_python_ng ),
128- )
80+ self .assertEqual (package_to_instrument , (_instruments_kafka_python ,))
0 commit comments