14
14
from unittest import TestCase , mock
15
15
16
16
from pika .adapters import BlockingConnection
17
+ from pika .adapters .blocking_connection import _QueueConsumerGeneratorInfo
17
18
from pika .channel import Channel
18
19
from wrapt import BoundFunctionWrapper
19
20
@@ -40,6 +41,9 @@ def test_instrument_api(self) -> None:
40
41
self .assertTrue (
41
42
isinstance (BlockingConnection .channel , BoundFunctionWrapper )
42
43
)
44
+ self .assertTrue (
45
+ isinstance (_QueueConsumerGeneratorInfo .__init__ , BoundFunctionWrapper )
46
+ )
43
47
assert hasattr (
44
48
instrumentation , "__opentelemetry_tracer_provider"
45
49
), "Tracer not stored for the object!"
@@ -57,15 +61,11 @@ def test_instrument_api(self) -> None:
57
61
@mock .patch (
58
62
"opentelemetry.instrumentation.pika.PikaInstrumentor._instrument_blocking_channel_consumers"
59
63
)
60
- @mock .patch (
61
- "opentelemetry.instrumentation.pika.PikaInstrumentor._decorate_queue_consumer_generator"
62
- )
63
- def test_instrument (
64
+ def test_instrument_channel (
64
65
self ,
65
66
instrument_blocking_channel_consumers : mock .MagicMock ,
66
67
instrument_basic_consume : mock .MagicMock ,
67
68
instrument_channel_functions : mock .MagicMock ,
68
- instrument_queue_consumer_generator : mock .MagicMock ,
69
69
):
70
70
PikaInstrumentor .instrument_channel (channel = self .channel )
71
71
assert hasattr (
@@ -74,7 +74,6 @@ def test_instrument(
74
74
instrument_blocking_channel_consumers .assert_called_once ()
75
75
instrument_basic_consume .assert_called_once ()
76
76
instrument_channel_functions .assert_called_once ()
77
- instrument_queue_consumer_generator .assert_called_once ()
78
77
79
78
@mock .patch ("opentelemetry.instrumentation.pika.utils._decorate_callback" )
80
79
def test_instrument_consumers (
0 commit comments