1
0

Refactor src layout and add logging lifecycle + tests

This commit is contained in:
2026-04-02 12:32:02 +02:00
parent e3c2b9ddee
commit a0a66264d2
13 changed files with 172 additions and 202 deletions

View File

@@ -0,0 +1,25 @@
from __future__ import annotations
import logging
import unittest
from src.logging_config import debug_log_lifecycle
class TestDebugLogLifecycle(unittest.TestCase):
def test_logs_function_start_and_end(self) -> None:
@debug_log_lifecycle
def sample(a: int, b: int) -> int:
return a + b
with self.assertLogs(sample.__module__, level="DEBUG") as captured:
result = sample(2, 3)
self.assertEqual(result, 5)
joined = "\n".join(captured.output)
self.assertIn("Start TestDebugLogLifecycle.test_logs_function_start_and_end.<locals>.sample", joined)
self.assertIn("End TestDebugLogLifecycle.test_logs_function_start_and_end.<locals>.sample", joined)
if __name__ == "__main__":
unittest.main()