31 lines
721 B
Python
31 lines
721 B
Python
import os
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
from fastapi.testclient import TestClient
|
|
|
|
|
|
@pytest.fixture
|
|
def tmp_registry(tmp_path: Path):
|
|
"""Set REGISTRY_PATH env var to a temp file for test isolation."""
|
|
registry = str(tmp_path / "projects.json")
|
|
os.environ["REGISTRY_PATH"] = registry
|
|
yield registry
|
|
os.environ.pop("REGISTRY_PATH", None)
|
|
|
|
|
|
@pytest.fixture
|
|
def client(tmp_registry):
|
|
"""Create a test client with isolated registry."""
|
|
from app.main import create_app
|
|
app = create_app()
|
|
return TestClient(app)
|
|
|
|
|
|
@pytest.fixture
|
|
def design_dir(tmp_path: Path) -> Path:
|
|
"""Create a minimal design directory for testing."""
|
|
d = tmp_path / "design"
|
|
d.mkdir()
|
|
return d
|