codex-python / tests /conftest.py
tailot's picture
Upload folder using huggingface_hub
2a9dc4c verified
Raw History Blame
992 Bytes
"""Shared pytest fixtures for the external datasets/codex-python package."""
from __future__ import annotations
import shutil
import sys
from pathlib import Path
import pytest
sys.dont_write_bytecode = True
PYTHON_ROOT = Path(__file__).resolve().parent.parent
if str(PYTHON_ROOT) not in sys.path:
sys.path.insert(0, str(PYTHON_ROOT))
from lingologos_python._codex_bridge import ensure_codex_on_path # noqa: E402
ensure_codex_on_path(PYTHON_ROOT)
@pytest.fixture
def sample_pkg(tmp_path: Path) -> Path:
"""Copy fixtures/sample_pkg into a clean temporary directory per test."""
src = PYTHON_ROOT / "fixtures" / "sample_pkg"
dst = tmp_path / "sample_pkg"
shutil.copytree(src, dst)
return dst
@pytest.fixture
def pattern_lab(tmp_path: Path) -> Path:
"""A private copy of the pattern fixture, for tests that write into it."""
src = PYTHON_ROOT / "fixtures" / "pattern_lab"
dst = tmp_path / "pattern_lab"
shutil.copytree(src, dst)
return dst