Files
yvgude--lean-ctx/clients/python/tests/test_conformance_live.py
T
wehub-resource-sync 26382a7ac6
CI / Clippy (push) Failing after 15m13s
CI / Test (ubuntu-latest) (push) Failing after 16m1s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Build (no embeddings / no ORT) (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Cookbook (Node) (push) Has been cancelled
CI / Pi Extension (Node) (push) Has been cancelled
CI / Rust SDK (lean-ctx-client) (push) Has been cancelled
CI / Embed SDK (lean-ctx-sdk) (push) Has been cancelled
CI / Python SDK (leanctx) (push) Has been cancelled
CI / Hermes Plugin (Python) (push) Has been cancelled
CI / SDK Conformance Matrix (push) Has been cancelled
CI / Coverage (push) Has been cancelled
CI / cargo-deny (push) Has been cancelled
CI / Adversarial Safety (push) Has been cancelled
CI / Benchmarks (push) Has been cancelled
CI / Output-Quality Gate (eval A/B) (push) Has been cancelled
CI / Documentation (push) Has been cancelled
CI / CI Green (push) Has been cancelled
JetBrains Plugin / Actionlint (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (rust) (push) Has been cancelled
JetBrains Plugin / Validation (push) Has been cancelled
JetBrains Plugin / Build (push) Has been cancelled
JetBrains Plugin / Test (push) Has been cancelled
Security Check / Security Scan (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:30 +08:00

50 lines
1.5 KiB
Python

"""Live conformance run against a real lean-ctx server (GL #395).
Driven by ``scripts/sdk-conformance.sh`` (CI job ``sdk-conformance``): the
script builds the engine, starts ``lean-ctx serve`` and exports
``LEANCTX_CONFORMANCE_URL``. Without that variable the suite skips, so plain
``pytest`` runs stay hermetic.
"""
from __future__ import annotations
import json
import os
import pathlib
import pytest
from leanctx import LeanCtxClient, run_conformance
URL = os.environ.get("LEANCTX_CONFORMANCE_URL", "").strip()
@pytest.mark.skipif(not URL, reason="LEANCTX_CONFORMANCE_URL not set")
def test_live_conformance_all_checks_pass() -> None:
client = LeanCtxClient(
URL, bearer_token=os.environ.get("LEANCTX_CONFORMANCE_TOKEN") or None
)
card = run_conformance(client)
matrix_dir = os.environ.get("LEANCTX_MATRIX_DIR", "").strip()
if matrix_dir:
out = pathlib.Path(matrix_dir) / "conformance-python.json"
out.write_text(
json.dumps(
{
"sdk": "python",
"passed": card.passed,
"total": card.total,
"all_passed": card.all_passed,
"checks": [
{"name": c.name, "passed": c.passed, "detail": c.detail}
for c in card.checks
],
},
indent=2,
)
)
failed = [f"{c.name}: {c.detail}" for c in card.checks if not c.passed]
assert card.all_passed, failed