Skip to content

armgit / laya

Public Imported from GitHub
0

Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.

test(serve): skip torch-dependent tests when torch is not installed

Swatantra Yadav502fa2996803
diff --git a/tests/test_serve.py b/tests/test_serve.py
index cc381dfc..5d24ab82 100644
--- a/tests/test_serve.py
+++ b/tests/test_serve.py
@@ -245,6 +245,7 @@ def test_helpers():
def test_thread_limit(monkeypatch):
+ pytest.importorskip("torch")
monkeypatch.delenv("LAYA_THREADS", raising=False)
assert _apply_thread_limit() is None # unset -> no-op, no torch import
for bad in ("0", "-4", "abc", ""):
@@ -421,6 +422,7 @@ def test_a_nested_choice_label_is_a_caller_error_not_a_server_fault(monkeypatch)
`ValueError` to 422, so the caller got a 500 "inference failed" with the reason discarded.
`ValueError` is what carries the message to the client, so the guard has to raise that type.
"""
+ pytest.importorskip("torch") # laya.agent imports torch at module level
class ValidatingRouter:
"""The real guard, without a checkpoint: what `Agent.system_one` runs before encoding.