feat(classifier): ✨ add classifier feature on log entries
add classifier on log entries, clean test functions and uniform fixtures in windows-1252 since all logs are encoded in windows-1252
This commit is contained in:
+28
-5
@@ -7,8 +7,14 @@ import pytest
|
||||
from logwatcher.config import FIXTURE_PATH
|
||||
from logwatcher.logging import setup_logging
|
||||
|
||||
# original logs directory
|
||||
ORIGINAL_LOGS_DIR = FIXTURE_PATH / "original_logs"
|
||||
# original log directory
|
||||
ORIGINAL_LOG_DIR = FIXTURE_PATH / "original_logs"
|
||||
|
||||
# valid log directory
|
||||
VALID_LOG_DIR = FIXTURE_PATH / "valid_logs"
|
||||
|
||||
# invalid_log_directory
|
||||
INVALID_LOG_DIR = FIXTURE_PATH / "invalid_logs"
|
||||
|
||||
# define temp directory only for testing
|
||||
os.environ["PYTEST_DEBUG_TEMPROOT"] = str(Path("output/test").absolute())
|
||||
@@ -22,11 +28,28 @@ def tmp_setup_logging(tmp_log_file):
|
||||
"""Redirige les logs vers un dossier temporaire pendant les tests."""
|
||||
setup_logging(file_path=tmp_log_file)
|
||||
|
||||
@pytest.fixture(name="original_log_files")
|
||||
def original_log_files_fixture() -> tuple[Path, ...]:
|
||||
@pytest.fixture(name="original_log_dir")
|
||||
def original_log_dir_fixture() -> 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())
|
||||
return FIXTURE_PATH / "original_logs"
|
||||
|
||||
@pytest.fixture(name="valid_log_dir")
|
||||
def valid_log_dir_fixture() -> Path:
|
||||
"""
|
||||
All valid log files provided by N2 technicians.
|
||||
Used for integration tests: these files contain both relevant and irrelevant logs
|
||||
for N2 technicians.
|
||||
"""
|
||||
return FIXTURE_PATH / "valid_logs"
|
||||
|
||||
@pytest.fixture(name="invalid_log_dir")
|
||||
def invalid_log_dir_fixture() -> Path:
|
||||
"""
|
||||
All invalid log files created for testing only.
|
||||
Used for integration tests of parsing.
|
||||
"""
|
||||
return FIXTURE_PATH / "invalid_logs"
|
||||
Reference in New Issue
Block a user