1
0

Migrate to uv sync and pytest coverage workflow

This commit is contained in:
2026-04-02 14:28:18 +02:00
parent 08ebab6348
commit 17e0099265
8 changed files with 2250 additions and 60 deletions

View File

@@ -1,25 +1,18 @@
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
def test_logs_function_start_and_end(caplog) -> 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)
with caplog.at_level(logging.DEBUG, logger=sample.__module__):
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()
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