"""テスト共通のフィクスチャ."""
from pathlib import Path
import pytest
REPO_ROOT = Path(__file__).resolve().parents[1]
@pytest.fixture(scope="session")
def repo_root() -> Path:
"""リポジトリ直下(`pyproject.toml` のある場所)を返す."""
return REPO_ROOT
@pytest.fixture(scope="session")
def data_csv_path(repo_root: Path) -> Path:
"""同梱学習データ `data/data.csv` のパスを返す(project-structure.md)."""
return repo_root / "data" / "data.csv"
@pytest.fixture(scope="session")
def data_csv_rows(data_csv_path: Path) -> list[list[str]]:
"""`data.csv` を UTF-8 で読み,全行をカンマ分割した 2 次元リストで返す."""
text = data_csv_path.read_text(encoding="utf-8")
return [line.split(",") for line in text.splitlines()]