Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ def _test_publish(self, exchange_type: Type[Exchange]):
with mock.patch.object(
PublishDecorator, "_get_publish_span"
) as mock_get_publish_span:
with mock.patch.object(
Exchange, "publish", return_value=asyncio.sleep(0)
) as mock_publish:
with mock.patch.object(Exchange, "publish") as mock_publish:
decorated_publish = PublishDecorator(
self.tracer, exchange
).decorate(mock_publish)
Expand All @@ -101,9 +99,7 @@ def _test_publish_works_with_not_recording_span(self, exchange_type):
mocked_not_recording_span = MagicMock()
mocked_not_recording_span.is_recording.return_value = False
mock_get_publish_span.return_value = mocked_not_recording_span
with mock.patch.object(
Exchange, "publish", return_value=asyncio.sleep(0)
) as mock_publish:
with mock.patch.object(Exchange, "publish") as mock_publish:
with mock.patch(
"opentelemetry.instrumentation.aio_pika.publish_decorator.propagate.inject"
) as mock_inject:
Expand Down Expand Up @@ -158,9 +154,7 @@ def _test_publish(self, exchange_type: Type[Exchange]):
with mock.patch.object(
PublishDecorator, "_get_publish_span"
) as mock_get_publish_span:
with mock.patch.object(
Exchange, "publish", return_value=asyncio.sleep(0)
) as mock_publish:
with mock.patch.object(Exchange, "publish") as mock_publish:
decorated_publish = PublishDecorator(
self.tracer, exchange
).decorate(mock_publish)
Expand All @@ -184,9 +178,7 @@ def _test_publish_works_with_not_recording_span(self, exchange_type):
mocked_not_recording_span = MagicMock()
mocked_not_recording_span.is_recording.return_value = False
mock_get_publish_span.return_value = mocked_not_recording_span
with mock.patch.object(
Exchange, "publish", return_value=asyncio.sleep(0)
) as mock_publish:
with mock.patch.object(Exchange, "publish") as mock_publish:
with mock.patch(
"opentelemetry.instrumentation.aio_pika.publish_decorator.propagate.inject"
) as mock_inject:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_instrumentor_connect(self):
cnx = async_call(aiopg.connect(database="test"))
cursor = async_call(cnx.cursor())
query = "SELECT * FROM test"
cursor.execute(query)
async_call(cursor.execute(query))

spans_list = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans_list), 1)
Expand Down Expand Up @@ -127,7 +127,7 @@ def test_instrumentor_create_pool(self):
cnx = async_call(pool.acquire())
cursor = async_call(cnx.cursor())
query = "SELECT * FROM test"
cursor.execute(query)
async_call(cursor.execute(query))

spans_list = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans_list), 1)
Expand Down