import sys
from pathlib import Path

import pytest

from spark_advisor_models.model import JobAnalysis

_TESTS_DIR = Path(__file__).resolve().parent
_REPO_ROOT = _TESTS_DIR.parent.parent.parent
SAMPLE_LOG = _REPO_ROOT / "sample_event_logs" / "sample_etl_job.json"

_tests_str = str(_TESTS_DIR)
if _tests_str not in sys.path:
    sys.path.insert(0, _tests_str)


@pytest.fixture
def sample_job() -> JobAnalysis:
    from spark_advisor_parser import parse_event_log

    return parse_event_log(SAMPLE_LOG)
