Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 1m24s
Injects runtime context so agents know capabilities. Detects provider mismatches and warns operators. Fixes #372
18 lines
942 B
Python
18 lines
942 B
Python
"""Tests for #372."""
|
|
import sys; sys.path.insert(0, str(__import__('pathlib').Path(__file__).resolve().parent.parent))
|
|
def _imp():
|
|
import importlib.util as iu
|
|
s=iu.spec_from_file_location("cs",str(__import__('pathlib').Path(__file__).resolve().parent.parent/"cron"/"scheduler.py"))
|
|
m=iu.module_from_spec(s)
|
|
try: s.loader.exec_module(m)
|
|
except: pass
|
|
return m
|
|
M=_imp()
|
|
class Test372:
|
|
def test_local(self): assert M._classify_runtime("ollama","q")=="local"
|
|
def test_cloud(self): assert M._classify_runtime("nous","m")=="cloud"
|
|
def test_mismatch(self): assert M._detect_provider_mismatch("Check Ollama","nous")=="ollama"
|
|
def test_none(self): assert M._detect_provider_mismatch("Check Nous","nous") is None
|
|
def test_cloud_ctx(self): assert "cloud" in M._build_job_prompt({"p":"x"},runtime_model="n/m",runtime_provider="nous").lower()
|
|
if __name__=="__main__": __import__('pytest').main([__file__,"-v"])
|