mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-12 20:15:10 +00:00
Renames 314 defs and 41 module/class-level constants. Keeps 11 names underscored where the stripped form collides in scope, plus 5.5.0 shims for the three symbols external service repos call.
41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
"""E2E-specific fixtures.
|
|
|
|
These tests are skipped unless ``--live`` is passed on the pytest CLI.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
|
|
def load_scenarios(config: pytest.Config) -> dict:
|
|
cached = getattr(config, "_e2e_scenarios_cache", None)
|
|
if cached is not None:
|
|
return cached
|
|
|
|
import yaml
|
|
|
|
path = Path(__file__).parent / "fixtures" / "fixtures.yaml"
|
|
data = yaml.safe_load(path.read_text()) if path.exists() else {}
|
|
selected = (config.getoption("--services") or "").strip()
|
|
services = (data or {}).get("services", {}) or {}
|
|
if selected:
|
|
wanted = {s.strip().upper() for s in selected.split(",") if s.strip()}
|
|
services = {k: v for k, v in services.items() if k.upper() in wanted}
|
|
cached = {"services": services}
|
|
config._e2e_scenarios_cache = cached # type: ignore[attr-defined]
|
|
return cached
|
|
|
|
|
|
def pytest_generate_tests(metafunc: pytest.Metafunc) -> None:
|
|
if "service_case" in metafunc.fixturenames:
|
|
scenarios = load_scenarios(metafunc.config)
|
|
params = [pytest.param((tag, conf), id=tag) for tag, conf in (scenarios.get("services") or {}).items()]
|
|
if not params:
|
|
params = [
|
|
pytest.param(("__none__", {}), id="no-services", marks=pytest.mark.skip(reason="no e2e fixtures"))
|
|
]
|
|
metafunc.parametrize("service_case", params)
|