test(classifier): ✅ add test on n2 patterns

This commit is contained in:
2026-08-07 17:27:37 +02:00
parent 19ff504890
commit 476b69d26f
8 changed files with 92 additions and 273 deletions
+15 -2
View File
@@ -4,9 +4,13 @@ from pathlib import Path
import pytest
from logwatcher.config import FIXTURE_PATH
from logwatcher.logging import setup_logging
# Forcer un dossier temporaire pour les tests
# original logs directory
ORIGINAL_LOGS_DIR = FIXTURE_PATH / "original_logs"
# define temp directory only for testing
os.environ["PYTEST_DEBUG_TEMPROOT"] = str(Path("output/test").absolute())
@pytest.fixture
@@ -16,4 +20,13 @@ def tmp_log_file(tmp_path):
@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)
setup_logging(file_path=tmp_log_file)
@pytest.fixture(name="original_log_files")
def original_log_files_fixture() -> tuple[Path, ...]:
"""
All real log files provided by N2 technicians.
Used for integration tests: these files contain both valid lines
and lines to be ignored (system logs, empty lines, directory headers).
"""
return tuple(ORIGINAL_LOGS_DIR.iterdir())