Skip to content

Commit 81bdcec

Browse files
committed
wip tests
1 parent f9ee608 commit 81bdcec

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

instrumentation/opentelemetry-instrumentation-pika/tests/test_pika_instrumentation.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from unittest import TestCase, mock
1515

1616
from pika.adapters import BlockingConnection
17+
from pika.adapters.blocking_connection import _QueueConsumerGeneratorInfo
1718
from pika.channel import Channel
1819
from wrapt import BoundFunctionWrapper
1920

@@ -40,6 +41,9 @@ def test_instrument_api(self) -> None:
4041
self.assertTrue(
4142
isinstance(BlockingConnection.channel, BoundFunctionWrapper)
4243
)
44+
self.assertTrue(
45+
isinstance(_QueueConsumerGeneratorInfo.__init__, BoundFunctionWrapper)
46+
)
4347
assert hasattr(
4448
instrumentation, "__opentelemetry_tracer_provider"
4549
), "Tracer not stored for the object!"
@@ -57,15 +61,11 @@ def test_instrument_api(self) -> None:
5761
@mock.patch(
5862
"opentelemetry.instrumentation.pika.PikaInstrumentor._instrument_blocking_channel_consumers"
5963
)
60-
@mock.patch(
61-
"opentelemetry.instrumentation.pika.PikaInstrumentor._decorate_queue_consumer_generator"
62-
)
63-
def test_instrument(
64+
def test_instrument_channel(
6465
self,
6566
instrument_blocking_channel_consumers: mock.MagicMock,
6667
instrument_basic_consume: mock.MagicMock,
6768
instrument_channel_functions: mock.MagicMock,
68-
instrument_queue_consumer_generator: mock.MagicMock,
6969
):
7070
PikaInstrumentor.instrument_channel(channel=self.channel)
7171
assert hasattr(
@@ -74,7 +74,6 @@ def test_instrument(
7474
instrument_blocking_channel_consumers.assert_called_once()
7575
instrument_basic_consume.assert_called_once()
7676
instrument_channel_functions.assert_called_once()
77-
instrument_queue_consumer_generator.assert_called_once()
7877

7978
@mock.patch("opentelemetry.instrumentation.pika.utils._decorate_callback")
8079
def test_instrument_consumers(

0 commit comments

Comments
 (0)