add tests 2

This commit is contained in:
G0DSEND016 2026-03-23 04:51:56 +01:00
parent 1a7e8aa355
commit 4fb1fe532b
7 changed files with 1116 additions and 19 deletions

0
testing/__init__.py Normal file
View File

1094
testing/charts/report.html Normal file

File diff suppressed because one or more lines are too long

View File

1
testing/results.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -2,11 +2,11 @@ import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).parent.parent
TESTS_DIR = Path(__file__).parent
ROOT = Path(__file__).parent.parent
TESTS_DIR = Path(__file__).parent
RESULTS_JSON = TESTS_DIR / "results.json"
REPORT_HTML = TESTS_DIR / "charts" / "report.html"
CHARTS_DIR = TESTS_DIR / "charts"
REPORT_HTML = TESTS_DIR / "charts" / "report.html"
CHARTS_DIR = TESTS_DIR / "charts"
def run_pytest() -> int:
@ -15,10 +15,7 @@ def run_pytest() -> int:
args = [
sys.executable, "-m", "pytest",
str(TESTS_DIR / "unit"),
str(TESTS_DIR / "integration"),
str(TESTS_DIR / "e2e"),
str(TESTS_DIR / "llm"),
str(TESTS_DIR / "tests"),
"--json-report",
f"--json-report-file={RESULTS_JSON}",
@ -26,14 +23,12 @@ def run_pytest() -> int:
f"--html={REPORT_HTML}",
"--self-contained-html",
f"--cov=api",
f"--cov=core",
"--cov=api",
"--cov=core",
"--cov-report=term-missing",
f"--cov-report=html:{CHARTS_DIR / 'coverage'}",
"-p", "no:terminal",
"--tb=short",
"-q",
"--tb=no",
]
return subprocess.run(args, cwd=str(ROOT), check=False).returncode
@ -41,8 +36,7 @@ def run_pytest() -> int:
def run_charts():
from testing.reports.charts import generate
out = generate()
print(f"Charts saved: {out}")
return generate()
if __name__ == "__main__":
@ -50,9 +44,17 @@ if __name__ == "__main__":
code = run_pytest()
if RESULTS_JSON.exists():
run_charts()
charts_path = None
if RESULTS_JSON.exists():
charts_path = run_charts()
print()
print(f"pytest-html: {REPORT_HTML}")
print(f"pytest-cov: {CHARTS_DIR / 'coverage' / 'index.html'}")
print(f"charts: {charts_path or CHARTS_DIR / 'report.png'}")
print()
print("Stop testing")
sys.exit(code)

View File

@ -8,7 +8,7 @@ from core.config import (
)
from core.system_prompt import get_system_prompt
MODELS = OLLAMA_MODELS | OPENAI_MODELS
MODELS = ["qwen3.5:cloud"]
TEST_QUERIES = [
{

View File

@ -2,7 +2,7 @@ import pytest
from core.system_prompt import get_system_prompt
from core.config import OLLAMA_MODELS, OPENAI_MODELS
MODELS = OLLAMA_MODELS | OPENAI_MODELS
MODELS = ["qwen3.5:cloud"]
@pytest.fixture(params=MODELS)
def prompt(request):