Skip to content

Commit dc74bf3

Browse files
committed
Update tests
1 parent 73c6ee1 commit dc74bf3

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/export/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def __init__(
187187
)
188188

189189
def on_emit(self, log_data: LogData) -> None:
190-
return self._batch_processor.on_emit(log_data)
190+
return self._batch_processor.emit(log_data)
191191

192192
def shutdown(self):
193193
return self._batch_processor.shutdown()

opentelemetry-sdk/tests/logs/test_export.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def test_emit_call_log_record(self):
348348
logger.addHandler(LoggingHandler(logger_provider=provider))
349349

350350
logger.error("error")
351-
self.assertEqual(log_record_processor.emit.call_count, 1)
351+
self.assertEqual(log_record_processor.on_emit.call_count, 1)
352352
log_record_processor.shutdown()
353353

354354
def test_with_multiple_threads(self): # pylint: disable=no-self-use
@@ -363,7 +363,7 @@ def test_with_multiple_threads(self): # pylint: disable=no-self-use
363363

364364
def bulk_emit(num_emit):
365365
for _ in range(num_emit):
366-
batch_processor.emit(EMPTY_LOG)
366+
batch_processor.on_emit(EMPTY_LOG)
367367

368368
total_expected_logs = 0
369369
with ThreadPoolExecutor(max_workers=69) as executor:
@@ -404,10 +404,10 @@ def test_logging_lib_not_invoked_in_batch_log_record_emit(self): # pylint: disa
404404
# If `emit` calls logging.log then this test will throw a maximum recursion depth exceeded exception and fail.
405405
try:
406406
with self.assertNoLogs(sdk_logger, logging.NOTSET):
407-
processor.emit(EMPTY_LOG)
407+
processor.on_emit(EMPTY_LOG)
408408
processor.shutdown()
409409
with self.assertNoLogs(sdk_logger, logging.NOTSET):
410-
processor.emit(EMPTY_LOG)
410+
processor.on_emit(EMPTY_LOG)
411411
finally:
412412
sdk_logger.removeHandler(handler)
413413

opentelemetry-sdk/tests/logs/test_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ class FakeProcessor(LogRecordProcessor):
384384
def __init__(self):
385385
self.log_data_emitted = []
386386

387-
def emit(self, log_data: LogData):
387+
def on_emit(self, log_data: LogData):
388388
self.log_data_emitted.append(log_data)
389389

390390
def shutdown(self):

opentelemetry-sdk/tests/logs/test_multi_log_processor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __init__(self, exporter, logs_list):
3838
self._log_list = logs_list
3939
self._closed = False
4040

41-
def emit(self, log_data):
41+
def on_emit(self, log_data):
4242
if self._closed:
4343
return
4444
self._log_list.append(
@@ -118,9 +118,9 @@ def test_on_emit(self):
118118
for mock in mocks:
119119
multi_log_record_processor.add_log_record_processor(mock)
120120
record = self.make_record()
121-
multi_log_record_processor.emit(record)
121+
multi_log_record_processor.on_emit(record)
122122
for mock in mocks:
123-
mock.emit.assert_called_with(record)
123+
mock.on_emit.assert_called_with(record)
124124
multi_log_record_processor.shutdown()
125125

126126
def test_on_shutdown(self):

0 commit comments

Comments
 (0)