fix(tests): use record.getMessage() instead of record.message for LogRecord

LogRecord objects do not have a .message attribute by default — it is
only populated after the record has been formatted by a Formatter.
The correct way to retrieve the formatted log message is getMessage().

This fixes AttributeError: 'LogRecord' object has no attribute 'message'
in test_cost_calculation_uses_debug_level and
test_batch_cost_calculation_uses_debug_level.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Julio Quinteros Pro
2026-02-18 11:46:32 -03:00
co-authored by Claude Sonnet 4.6
parent 45d3d1adfd
commit aa9d97b23d
@@ -67,7 +67,7 @@ def test_cost_calculation_uses_debug_level():
# Find the cost calculation log records
cost_calc_records = [
record for record in handler.records
if "selected model name for cost calculation" in record.message
if "selected model name for cost calculation" in record.getMessage()
]
# Verify that cost calculation logs are at DEBUG level
@@ -126,7 +126,7 @@ def test_batch_cost_calculation_uses_debug_level():
# Find batch cost calculation log records
batch_cost_records = [
record for record in handler.records
if "Calculating batch cost per token" in record.message
if "Calculating batch cost per token" in record.getMessage()
]
# Verify logs exist and are at DEBUG level