You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
opentelemetry-instrumentation-aiokafka: test warnings — Unclosed AIOKafkaProducer and unawaited coroutine #4383
OS: any
Python version: 3.13, 3.14
Package version: opentelemetry-instrumentation-aiokafka 0.62b0.dev
What happened?
Running the aiokafka instrumentation test suite produces two warnings:
ERROR asyncio:base_events.py: Unclosed AIOKafkaProducer intest_send_and_wait. the test creates a producer but never calls producer.stop(), leaving the resource unclosed.
RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited in test_wrap_getmany. the _create_consumer_span parameter is typed as mock.MagicMock but the real function is async. When the code calls await _create_consumer_span(...) and then record_span.get_span_context(), the MagicMock auto-creates coroutine return values that are never awaited.
Steps to Reproduce
tox -e py3-test-instrumentation-aiokafka -- -v
Observe the Unclosed AIOKafkaProducer error log during test_send_and_wait
and the RuntimeWarning after the test session completes.
Expected Result
Tests run cleanly with no resource warnings or unawaited coroutine warnings.
Actual Result
ERROR asyncio:base_events.py:1871 Unclosed AIOKafkaProducer
producer: <aiokafka.producer.producer.AIOKafkaProducer object at 0x...>
RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
Additional context
Neither warning causes test failures — all 17 tests pass. These are cosmetic
issues but they add noise to the test output and could mask real warnings.
Activity