test(classifier): ✅ add test on n2 patterns
This commit is contained in:
+15
-2
@@ -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())
|
||||
Reference in New Issue
Block a user