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.

ci(workflows): run missing test suites in CI and guard against test omission

Swatantra Yadav6c5751328cbb
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7a9cca5f..4e36a4fb 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -132,6 +132,10 @@ jobs:
python tests/test_portability.py
python tests/test_training.py
python tests/test_example_server_limits.py
+ python tests/test_blank_lang_routing.py
+ python tests/test_export_onnx_safety.py
+ python tests/test_load_errors.py
+ python tests/test_revision_pinning.py
- name: Email cleaning tests
run: python tests/test_email.py
@@ -141,7 +145,7 @@ jobs:
- name: Chinese short-command benchmark tests
run: python -m unittest discover -s research/benchmarks/zh_short_commands/tests -v
- # These four are pytest suites, and `python tests/<name>.py` does not run them: it defines
+ # These are pytest suites, and `python tests/<name>.py` does not run them: it defines
# the test functions and exits 0, having asserted nothing. They were counted by the suite
# list above without ever executing, which is how the HTTP surface came to have no coverage
# in CI at all (#374).
@@ -153,6 +157,7 @@ jobs:
run: |
python -m pytest tests/test_serve.py \
tests/test_router_batch.py \
+ tests/test_predict_batch.py \
tests/test_system_one_lang.py \
tests/test_audit_regressions.py \
tests/test_truncation_direction.py \
@@ -233,13 +238,19 @@ jobs:
# pass -- a change to a container script, so it belongs in its own PR, not this one.
- name: Routing and language-detection tests
run: |
- for t in test_router test_criteria test_download test_shortlist \
- test_decision_model test_packaging test_lang_guess \
- test_identifier_complexity \
- test_calibration_persistence test_context_manager \
+ for t in test_router test_criteria test_batch test_predict_long \
+ test_structured test_structured_api test_onnx_lang_parity \
+ test_download test_shortlist test_decision_model \
+ test_head_checkpointing test_packaging test_doc_tables \
+ test_tokenizer_cache test_tokenizer_concurrency test_lazy_import \
+ test_runtime_fixes test_lang_guess test_identifier_complexity \
+ test_lang_stats test_calibration_persistence test_context_manager \
test_criteria_normalization test_docker_entrypoint \
test_empty_questions test_router_memory test_shortlist_cosine \
- test_temperature_loading; do
+ test_temperature_loading test_confidence test_cli test_mcp \
+ test_langchain test_portability test_training \
+ test_example_server_limits test_blank_lang_routing \
+ test_export_onnx_safety test_load_errors test_revision_pinning; do
if [ "$t" = "test_docker_entrypoint" ]; then
echo "skipping $t: docker/entrypoint.py is Linux-container only"
continue
@@ -254,13 +265,14 @@ jobs:
python tests/test_hooks_api.py
shell: bash
- # Same five pytest suites as the Linux job. They are named explicitly rather than added to
+ # Same pytest suites as the Linux job. They are named explicitly rather than added to
# the loop above, because the loop runs each file as a script and that is exactly what does
# not execute a pytest suite (#374).
- name: Pytest suites (serve, batch, system-one, audit regressions, truncation)
run: |
python -m pytest tests/test_serve.py \
tests/test_router_batch.py \
+ tests/test_predict_batch.py \
tests/test_system_one_lang.py \
tests/test_audit_regressions.py \
tests/test_truncation_direction.py \
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 8344b4ba..27128776 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -42,14 +42,23 @@ jobs:
python tests/test_criteria.py
python tests/test_batch.py
python tests/test_predict_long.py
+ python tests/test_hooks.py
+ python tests/test_hooks_api.py
python tests/test_onnx_lang_parity.py
python tests/test_email.py
python tests/test_download.py
python tests/test_shortlist.py
python tests/test_decision_model.py
+ python tests/test_head_checkpointing.py
python tests/test_packaging.py
python tests/test_doc_tables.py
+ python tests/test_tokenizer_cache.py
+ python tests/test_tokenizer_concurrency.py
+ python tests/test_lazy_import.py
+ python tests/test_runtime_fixes.py
python tests/test_lang_guess.py
+ python tests/test_identifier_complexity.py
+ python tests/test_lang_stats.py
python tests/test_calibration_persistence.py
python tests/test_context_manager.py
python tests/test_criteria_normalization.py
@@ -58,7 +67,13 @@ jobs:
python tests/test_router_memory.py
python tests/test_shortlist_cosine.py
python tests/test_temperature_loading.py
+ python tests/test_confidence.py
python tests/test_cli.py
+ python tests/test_training.py
+ python tests/test_portability.py
+ python tests/test_blank_lang_routing.py
+ python tests/test_load_errors.py
+ python tests/test_revision_pinning.py
- name: Build
run: python -m build
diff --git a/tests/test_packaging.py b/tests/test_packaging.py
index 66971a35..45c5cfbf 100644
--- a/tests/test_packaging.py
+++ b/tests/test_packaging.py
@@ -4,6 +4,7 @@ Text parsing, not tomllib: the floor is 3.10 and tomllib arrives in 3.11.
"""
import os
import re
+import shlex
import sys
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -93,6 +94,95 @@ missing_from_ci = [
]
check("ci/tests every advertised Python version", missing_from_ci, [])
+# Every test in tests/ must be wired into CI workflows (ci.yml or docker.yml),
+# unless explicitly exempted with a documented rationale (#399).
+def _clean_command_line(line):
+ line = line.strip()
+ if not line or line.startswith("#"):
+ return ""
+ try:
+ return " ".join(shlex.split(line, comments=True))
+ except ValueError:
+ return re.sub(r"(?:\s+|^)#.*$", "", line).strip()
+
+
+def _invoked_workflow_tests(yaml_text):
+ """Extract test files that are actually executed by python or pytest in run: steps."""
+ run_lines = []
+ in_run = False
+ run_indent = 0
+ for line in yaml_text.splitlines():
+ indent = len(line) - len(line.lstrip())
+ match = re.match(r"^(\s*)-\s+run:\s*(\|?>?)(.*)$", line) or re.match(r"^(\s*)run:\s*(\|?>?)(.*)$", line)
+ if match:
+ in_run = True
+ run_indent = indent
+ inline_cmd = match.group(3).strip()
+ cleaned = _clean_command_line(inline_cmd)
+ if cleaned:
+ run_lines.append(cleaned)
+ continue
+ if in_run:
+ if line.strip() and indent <= run_indent:
+ in_run = False
+ else:
+ stripped = line.strip()
+ if stripped and not stripped.startswith("#"):
+ cleaned = _clean_command_line(stripped)
+ if cleaned:
+ if stripped.endswith("\\") and not cleaned.endswith("\\"):
+ cleaned += " \\"
+ run_lines.append(cleaned)
+
+ # Merge backslash continuation lines (e.g. multi-line pytest argument lists)
+ merged_lines = []
+ buf = []
+ for line in run_lines:
+ if line.endswith("\\"):
+ buf.append(line[:-1].strip())
+ else:
+ if buf:
+ buf.append(line)
+ merged_lines.append(" ".join(buf))
+ buf = []
+ else:
+ merged_lines.append(line)
+ if buf:
+ merged_lines.append(" ".join(buf))
+
+ # Match executable python or pytest invocations, ignoring mentions in echo/cat/test
+ invoked = set()
+ for cmd in merged_lines:
+ for part in re.split(r";|&&|\|\||\|", cmd):
+ part = part.strip()
+ if re.search(r"\b(?:pytest|python(?:\d+(?:\.\d+)?)?\s+-m\s+pytest)\b", part):
+ invoked.update(re.findall(r"\btests/(test_[a-zA-Z0-9_]+\.py)\b", part))
+ elif re.search(r"\bpython(?:\d+(?:\.\d+)?)?\s+.*?tests/(test_[a-zA-Z0-9_]+\.py)\b", part):
+ invoked.update(re.findall(r"\btests/(test_[a-zA-Z0-9_]+\.py)\b", part))
+ return invoked
+
+
+docker_workflow = read(os.path.join(".github", "workflows", "docker.yml"))
+registered_test_files = _invoked_workflow_tests(workflow) | _invoked_workflow_tests(docker_workflow)
+
+EXEMPT_TEST_SUITES = {
+ "test_local_e2e.py": "Requires local checkpoints under ~/laya_models (AGENTS.md)",
+ "test_mcp_local_e2e.py": "Requires local checkpoints under ~/laya_models (AGENTS.md)",
+ "test_onnx.py": "Requires onnx extra; skip-guarded on lane without it (AGENTS.md)",
+ "test_fast.py": "Requires CUDA and tilelang extra (AGENTS.md)",
+ "test_server_example.py": "Requires cached or downloaded weights for examples/server.py",
+}
+
+all_test_files = [
+ f for f in os.listdir(os.path.join(ROOT, "tests"))
+ if f.startswith("test_") and f.endswith(".py")
+]
+untested_suites = [
+ f for f in sorted(all_test_files)
+ if f not in EXEMPT_TEST_SUITES and f not in registered_test_files
+]
+check("ci/wires every non-exempt test suite", untested_suites, [])
+
# --------------------------------------------------------------- markdown links
# Nothing checked these, and the README ships to PyPI and to the model card. Only