test(logging); add tests for setup_handler and setup_formatter function
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user