forked from LiveCarta/ContentGeneration
19 lines
530 B
Python
19 lines
530 B
Python
from __future__ import annotations
|
|
|
|
import logging
|
|
|
|
from src.logging_config import debug_log_lifecycle
|
|
|
|
|
|
def test_logs_function_start_and_end(caplog) -> None:
|
|
@debug_log_lifecycle
|
|
def sample(a: int, b: int) -> int:
|
|
return a + b
|
|
|
|
with caplog.at_level(logging.DEBUG, logger=sample.__module__):
|
|
result = sample(2, 3)
|
|
|
|
assert result == 5
|
|
assert "Start test_logs_function_start_and_end.<locals>.sample" in caplog.text
|
|
assert "End test_logs_function_start_and_end.<locals>.sample" in caplog.text
|