test(logging); add tests for setup_handler and setup_formatter function

This commit is contained in:
2026-07-29 19:42:52 +02:00
parent d02887f164
commit 63893513ee
7 changed files with 218 additions and 11 deletions
+19
View File
@@ -0,0 +1,19 @@
# tests/conftest.py
import os
from pathlib import Path
import pytest
from logwatcher.logging import setup_logging
# Forcer un dossier temporaire pour les tests
os.environ["PYTEST_DEBUG_TEMPROOT"] = str(Path("output/test").absolute())
@pytest.fixture
def tmp_log_file(tmp_path):
return tmp_path / "logwatcher_test.log"
@pytest.fixture(autouse=True)
def tmp_setup_logging(tmp_log_file):
"""Redirige les logs vers un dossier temporaire pendant les tests."""
setup_logging(file_path=tmp_log_file)