add tests 2
This commit is contained in:
parent
1a7e8aa355
commit
4fb1fe532b
0
testing/__init__.py
Normal file
0
testing/__init__.py
Normal file
1094
testing/charts/report.html
Normal file
1094
testing/charts/report.html
Normal file
File diff suppressed because one or more lines are too long
0
testing/reports/__init__.py
Normal file
0
testing/reports/__init__.py
Normal file
1
testing/results.json
Normal file
1
testing/results.json
Normal file
File diff suppressed because one or more lines are too long
@ -2,11 +2,11 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
ROOT = Path(__file__).parent.parent
|
ROOT = Path(__file__).parent.parent
|
||||||
TESTS_DIR = Path(__file__).parent
|
TESTS_DIR = Path(__file__).parent
|
||||||
RESULTS_JSON = TESTS_DIR / "results.json"
|
RESULTS_JSON = TESTS_DIR / "results.json"
|
||||||
REPORT_HTML = TESTS_DIR / "charts" / "report.html"
|
REPORT_HTML = TESTS_DIR / "charts" / "report.html"
|
||||||
CHARTS_DIR = TESTS_DIR / "charts"
|
CHARTS_DIR = TESTS_DIR / "charts"
|
||||||
|
|
||||||
|
|
||||||
def run_pytest() -> int:
|
def run_pytest() -> int:
|
||||||
@ -15,10 +15,7 @@ def run_pytest() -> int:
|
|||||||
args = [
|
args = [
|
||||||
sys.executable, "-m", "pytest",
|
sys.executable, "-m", "pytest",
|
||||||
|
|
||||||
str(TESTS_DIR / "unit"),
|
str(TESTS_DIR / "tests"),
|
||||||
str(TESTS_DIR / "integration"),
|
|
||||||
str(TESTS_DIR / "e2e"),
|
|
||||||
str(TESTS_DIR / "llm"),
|
|
||||||
|
|
||||||
"--json-report",
|
"--json-report",
|
||||||
f"--json-report-file={RESULTS_JSON}",
|
f"--json-report-file={RESULTS_JSON}",
|
||||||
@ -26,14 +23,12 @@ def run_pytest() -> int:
|
|||||||
f"--html={REPORT_HTML}",
|
f"--html={REPORT_HTML}",
|
||||||
"--self-contained-html",
|
"--self-contained-html",
|
||||||
|
|
||||||
f"--cov=api",
|
"--cov=api",
|
||||||
f"--cov=core",
|
"--cov=core",
|
||||||
"--cov-report=term-missing",
|
"--cov-report=term-missing",
|
||||||
f"--cov-report=html:{CHARTS_DIR / 'coverage'}",
|
f"--cov-report=html:{CHARTS_DIR / 'coverage'}",
|
||||||
|
|
||||||
"-p", "no:terminal",
|
"--tb=no",
|
||||||
"--tb=short",
|
|
||||||
"-q",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
return subprocess.run(args, cwd=str(ROOT), check=False).returncode
|
return subprocess.run(args, cwd=str(ROOT), check=False).returncode
|
||||||
@ -41,8 +36,7 @@ def run_pytest() -> int:
|
|||||||
|
|
||||||
def run_charts():
|
def run_charts():
|
||||||
from testing.reports.charts import generate
|
from testing.reports.charts import generate
|
||||||
out = generate()
|
return generate()
|
||||||
print(f"Charts saved: {out}")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
@ -50,9 +44,17 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
code = run_pytest()
|
code = run_pytest()
|
||||||
|
|
||||||
if RESULTS_JSON.exists():
|
charts_path = None
|
||||||
run_charts()
|
|
||||||
|
|
||||||
|
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")
|
print("Stop testing")
|
||||||
|
|
||||||
sys.exit(code)
|
sys.exit(code)
|
||||||
@ -8,7 +8,7 @@ from core.config import (
|
|||||||
)
|
)
|
||||||
from core.system_prompt import get_system_prompt
|
from core.system_prompt import get_system_prompt
|
||||||
|
|
||||||
MODELS = OLLAMA_MODELS | OPENAI_MODELS
|
MODELS = ["qwen3.5:cloud"]
|
||||||
|
|
||||||
TEST_QUERIES = [
|
TEST_QUERIES = [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import pytest
|
|||||||
from core.system_prompt import get_system_prompt
|
from core.system_prompt import get_system_prompt
|
||||||
from core.config import OLLAMA_MODELS, OPENAI_MODELS
|
from core.config import OLLAMA_MODELS, OPENAI_MODELS
|
||||||
|
|
||||||
MODELS = OLLAMA_MODELS | OPENAI_MODELS
|
MODELS = ["qwen3.5:cloud"]
|
||||||
|
|
||||||
@pytest.fixture(params=MODELS)
|
@pytest.fixture(params=MODELS)
|
||||||
def prompt(request):
|
def prompt(request):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user