any2human / tests /conftest.py
idnameraj's picture
Vary sentence structure per request instead of repeating one rewrite.
ffb5352
Raw
History Blame Contribute Delete
853 Bytes
"""Pytest configuration."""
from __future__ import annotations
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parent.parent
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
@pytest.fixture(autouse=True)
def fixed_structure(monkeypatch):
"""Pin structural rotation off so assertions can name one exact rewrite.
Production picks a different valid structure per request. Tests that cover
that behaviour opt back in with the ``structural_variation`` fixture.
"""
from app.engine import orchestrator
monkeypatch.setattr(orchestrator, "ENGINE_STRUCTURAL_VARIATION", False)
@pytest.fixture
def structural_variation(monkeypatch):
from app.engine import orchestrator
monkeypatch.setattr(orchestrator, "ENGINE_STRUCTURAL_VARIATION", True)