ontology
This commit is contained in:
45
ontology_platform/tests/e2e/conftest.py
Normal file
45
ontology_platform/tests/e2e/conftest.py
Normal file
@@ -0,0 +1,45 @@
|
||||
"""E2E test configuration.
|
||||
|
||||
These tests are SKIPPED by default. To run them set ``LLM_API_KEY`` and
|
||||
``LLM_PROVIDER`` (and any model overrides) in the environment, then run:
|
||||
|
||||
pytest tests/e2e -m e2e
|
||||
|
||||
They exercise the full OntoCast workflow end-to-end — LLM calls included —
|
||||
and so they cost real money. Keep them out of CI default runs.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||
for p in (REPO_ROOT, REPO_ROOT / "vendored" / "ontocast"):
|
||||
if str(p) not in sys.path:
|
||||
sys.path.insert(0, str(p))
|
||||
|
||||
|
||||
def pytest_collection_modifyitems(
|
||||
config: pytest.Config, items: list[pytest.Item]
|
||||
) -> None:
|
||||
"""Skip all e2e tests when LLM_API_KEY is not configured."""
|
||||
if os.environ.get("LLM_API_KEY"):
|
||||
return
|
||||
skip_marker = pytest.mark.skip(
|
||||
reason="E2E tests require LLM_API_KEY in environment."
|
||||
)
|
||||
for item in items:
|
||||
# Only apply to tests in this directory tree.
|
||||
if "tests/e2e" in str(item.fspath).replace("\\", "/"):
|
||||
item.add_marker(skip_marker)
|
||||
|
||||
|
||||
def pytest_configure(config: pytest.Config) -> None:
|
||||
config.addinivalue_line(
|
||||
"markers",
|
||||
"e2e: end-to-end test that requires a real LLM and may cost money",
|
||||
)
|
||||
Reference in New Issue
Block a user