"""pytest setup for the tide-table pipeline tests.

Puts the tide-table dir on sys.path so the pipeline modules import as top-level
(`import tidal_score`, `import build_catalog_view`) exactly as they do in prod.
"""
import sys
from pathlib import Path

import pytest

HERE = Path(__file__).resolve().parent
TIDE_TABLE = HERE.parent
REPO = TIDE_TABLE.parent.parent          # …/Sound/Tidal
sys.path.insert(0, str(TIDE_TABLE))


@pytest.fixture(scope="session")
def repo():
    return REPO


@pytest.fixture(scope="session")
def fixtures():
    return HERE / "fixtures"


@pytest.fixture(scope="session")
def view():
    """The real pipeline output, built once (IT-on-real-data)."""
    import build_catalog_view as bcv
    return bcv.build()


@pytest.fixture(scope="session")
def registry():
    """The real pattern registry, built once (IT-on-real-data)."""
    import pattern_ngrams as pn
    return pn.build()
