chore(tests): remove Langfuse from all preprocessor tests
I test del preprocessor sono deterministici — nessun LLM coinvolto, nessuno score da tracciare. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,6 @@ from pathlib import Path
|
|||||||
import pytest
|
import pytest
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from app.core.langfuse_client import get_langfuse
|
|
||||||
from app.core.preprocessors import detect_content_type, preprocess
|
from app.core.preprocessors import detect_content_type, preprocess
|
||||||
|
|
||||||
_DEFAULT_DIR = Path(__file__).parent / "fixtures" / "preprocessors"
|
_DEFAULT_DIR = Path(__file__).parent / "fixtures" / "preprocessors"
|
||||||
@@ -40,14 +39,6 @@ def _content(case: dict, data_dir: Path) -> str:
|
|||||||
return (data_dir / case["file"]).read_text(encoding="utf-8")
|
return (data_dir / case["file"]).read_text(encoding="utf-8")
|
||||||
|
|
||||||
|
|
||||||
def _lf_score(name: str, value: float) -> None:
|
|
||||||
lf = get_langfuse()
|
|
||||||
if lf:
|
|
||||||
trace = lf.trace(name=f"eval-{name}")
|
|
||||||
lf.score(trace_id=trace.id, name=name, value=value, data_type="NUMERIC")
|
|
||||||
lf.flush()
|
|
||||||
|
|
||||||
|
|
||||||
# ── parametrize at collection time via pytest hook ────────────────────
|
# ── parametrize at collection time via pytest hook ────────────────────
|
||||||
|
|
||||||
def pytest_generate_tests(metafunc):
|
def pytest_generate_tests(metafunc):
|
||||||
@@ -71,7 +62,6 @@ def test_detect(preprocess_case, pytestconfig) -> None:
|
|||||||
filename = case.get("file", "")
|
filename = case.get("file", "")
|
||||||
ct = detect_content_type(filename, raw)
|
ct = detect_content_type(filename, raw)
|
||||||
expected = case["detect"]
|
expected = case["detect"]
|
||||||
_lf_score(f"preprocess.detect.{case['id']}", 1.0 if ct == expected else 0.0)
|
|
||||||
assert ct == expected, f"[{case['id']}] expected {expected!r}, got {ct!r}"
|
assert ct == expected, f"[{case['id']}] expected {expected!r}, got {ct!r}"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user