I've started seeing failures in this test today in CI (pypy / windows), since this is asserting a mock I guess there's something wrong in the test.
__________ TestSynchronousMeasurementConsumer.test_collect_deadline ___________
self = <test_measurement_consumer.TestSynchronousMeasurementConsumer testMethod=test_collect_deadline>
mock_callback_options = <MagicMock name='CallbackOptions' id='1661901429728'>
MockMetricReaderStorage = <MagicMock name='MetricReaderStorage' id='1661901430400'>
@patch(
"opentelemetry.sdk.metrics._internal."
"measurement_consumer.CallbackOptions"
)
def test_collect_deadline(
self, mock_callback_options, MockMetricReaderStorage
):
reader_mock = Mock()
reader_storage_mock = Mock()
MockMetricReaderStorage.return_value = reader_storage_mock
consumer = SynchronousMeasurementConsumer(
SdkConfiguration(
exemplar_filter=Mock(),
resource=Mock(),
metric_readers=[reader_mock],
views=Mock(),
)
)
def sleep_1(*args, **kwargs):
sleep(1)
return []
consumer.register_asynchronous_instrument(
Mock(**{"callback.side_effect": sleep_1})
)
consumer.register_asynchronous_instrument(
Mock(**{"callback.side_effect": sleep_1})
)
consumer.collect(reader_mock)
> callback_options_time_call = mock_callback_options.mock_calls[
-1
].kwargs["timeout_millis"]
E KeyError: 'timeout_millis'
I've started seeing failures in this test today in CI (pypy / windows), since this is asserting a mock I guess there's something wrong in the test.