Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

tests: three suite gaps a live PC showed (#3236)

Norm5b14fe23f7ea
diff --git a/tools/test_conversation_cache_disabled.py b/tools/test_conversation_cache_disabled.py
index d389ac9f9..59c3e6851 100644
--- a/tools/test_conversation_cache_disabled.py
+++ b/tools/test_conversation_cache_disabled.py
@@ -8,6 +8,8 @@ import sys
import tempfile
import unittest
+sys.path.insert(0, str(Path(__file__).resolve().parents[1])) # runnable as tools/test_x.py from the repo root too
+
from tools.conversation_cache_disabled import NAMES, SETTINGS, STATE_KEYS, common_args, state_hashes, verify
diff --git a/tools/test_conversation_cache_growth.py b/tools/test_conversation_cache_growth.py
index 364234491..f89f2be82 100644
--- a/tools/test_conversation_cache_growth.py
+++ b/tools/test_conversation_cache_growth.py
@@ -8,6 +8,8 @@ import sys
import tempfile
import unittest
+sys.path.insert(0, str(Path(__file__).resolve().parents[1])) # runnable as tools/test_x.py from the repo root too
+
from tools.conversation_cache_growth import NAMES, SECRET, SETTINGS, STATE_KEYS, verify
diff --git a/tools/test_conversation_cache_http_smoke.py b/tools/test_conversation_cache_http_smoke.py
index fd0a79d2d..50211a87d 100644
--- a/tools/test_conversation_cache_http_smoke.py
+++ b/tools/test_conversation_cache_http_smoke.py
@@ -9,6 +9,8 @@ import tempfile
import unittest
from unittest.mock import Mock
+sys.path.insert(0, str(Path(__file__).resolve().parents[1])) # runnable as tools/test_x.py from the repo root too
+
from tools.conversation_cache_http_smoke import run
diff --git a/tools/test_conversation_cache_isolation.py b/tools/test_conversation_cache_isolation.py
index 7205d4d4d..d87e9287c 100644
--- a/tools/test_conversation_cache_isolation.py
+++ b/tools/test_conversation_cache_isolation.py
@@ -7,6 +7,8 @@ import sys
import tempfile
import unittest
+sys.path.insert(0, str(Path(__file__).resolve().parents[1])) # runnable as tools/test_x.py from the repo root too
+
from tools.conversation_cache_isolation import STATE_KEYS, fixtures, verify
from tools.gguf_reader import GGUFFile
diff --git a/tools/test_conversation_cache_parity.py b/tools/test_conversation_cache_parity.py
index 3f950ebd9..b9a790134 100644
--- a/tools/test_conversation_cache_parity.py
+++ b/tools/test_conversation_cache_parity.py
@@ -6,6 +6,8 @@ import sys
import tempfile
import unittest
+sys.path.insert(0, str(Path(__file__).resolve().parents[1])) # runnable as tools/test_x.py from the repo root too
+
from tools.conversation_cache_parity import STATE_KEYS, engine_args, pressure_budget_hint, verify_admission, verify_exchange, verify_pressure, verify_results
diff --git a/tools/test_conversation_cache_soak.py b/tools/test_conversation_cache_soak.py
index 7d815890b..7ac12a6d7 100644
--- a/tools/test_conversation_cache_soak.py
+++ b/tools/test_conversation_cache_soak.py
@@ -6,6 +6,8 @@ import sys
import tempfile
import unittest
+sys.path.insert(0, str(Path(__file__).resolve().parents[1])) # runnable as tools/test_x.py from the repo root too
+
from tools.conversation_cache_soak import STATE_KEYS, answer_text, verify
diff --git a/tools/test_iq_pack.py b/tools/test_iq_pack.py
index 0e0f5e8b2..f1faeabe4 100644
--- a/tools/test_iq_pack.py
+++ b/tools/test_iq_pack.py
@@ -14,9 +14,25 @@ import numpy as np
sys.path.insert(0, str(Path(__file__).resolve().parent)) # runnable from the repo root too
from _paths import add_gguf_py
-add_gguf_py()
-from gguf import GGUFWriter, GGMLQuantizationType as Q, quants
-import iq_pack
+import iq_pack # needs numpy + gguf_reader only, not gguf-py: import it unguarded
+
+try:
+ add_gguf_py() # llama.cpp's gguf-py: setup.py clones it; gguf_py() exits when absent
+ from gguf import GGUFWriter, GGMLQuantizationType as Q, quants
+except SystemExit:
+ GGUF_PY = None
+else:
+ GGUF_PY = "found"
+
+
+def require_gguf_py(test):
+ """setUpClass for the classes that build GGUF fixtures: skip (not fail) on a checkout without llama.cpp."""
+ @classmethod
+ def setUpClass(cls):
+ if GGUF_PY is None:
+ raise unittest.SkipTest("llama.cpp's gguf-py not found: run setup.py (it clones llama.cpp into "
+ "third_party/) or set STRATA_GGUF_PY")
+ return setUpClass
def write_gguf(path, tensors, split=None, arch=True):
@@ -37,6 +53,7 @@ def write_gguf(path, tensors, split=None, arch=True):
class CompatibilityTests(unittest.TestCase):
+ setUpClass = require_gguf_py(unittest.TestCase)
def test_bf16_halfway_rounds_to_even(self):
values = np.array([0x3F808000, 0x3F818000, 0xBF808000, 0xBF818000], dtype=np.uint32)
got = np.frombuffer(iq_pack.bf16_bytes(values.view(np.uint8), "F32"), dtype=np.uint16)
@@ -253,6 +270,8 @@ class ConversionTests(unittest.TestCase):
"""CS2: FORM decides the engine's form; exact F32->BF16 by default, rounding only with --compat-bf16, the PLE
conv F32 -> F16 by the loader (index kind 3), non-finite values refused, every conversion in conversions.json."""
+ setUpClass = require_gguf_py(unittest.TestCase)
+
def test_exact_f32_to_bf16_by_default(self):
with tempfile.TemporaryDirectory(ignore_cleanup_errors=True) as tmp:
x = bits(np.arange(64, dtype=np.uint32).reshape(2, 32) << 16 | 0x3F000000) # BF16 values held as F32
@@ -362,8 +381,9 @@ def expert(seed, shape):
return np.random.default_rng(seed).standard_normal((N_EXPERT, *shape)).astype(np.float32)
-def split_model(root, name="model", split_layer=True, dup=False, split_no=None, gate1=Q.Q8_0, seed=0):
+def split_model(root, name="model", split_layer=True, dup=False, split_no=None, gate1=None, seed=0):
"""Writes the 4 shards; returns their paths."""
+ gate1 = Q.Q8_0 if gate1 is None else gate1 # not a default arg: the module imports without gguf-py
gu, dn = (32, 32), (32, 32)
router = [(f"blk.{l}.ffn_gate_inp.weight", np.full((N_EXPERT, 32), 0.5, np.float32), Q.F32) for l in (0, 1)]
l0 = [(f"blk.0.ffn_{r}_exps.weight", expert(seed + 10 + i, gu if r != "down" else dn), Q.Q8_0)
@@ -406,6 +426,7 @@ def expected_experts(model):
class SplitArtifactTests(unittest.TestCase):
+ setUpClass = require_gguf_py(unittest.TestCase)
def test_four_shards_and_a_layer_split_per_role(self):
with tempfile.TemporaryDirectory(ignore_cleanup_errors=True) as tmp:
root = Path(tmp)
@@ -689,6 +710,7 @@ class HadamardTests(unittest.TestCase):
class NativeExpertsV5Tests(unittest.TestCase):
"""The v5 mark (Hadamard-folded experts) rewrites only the tables the packer writes, v3 and v4."""
+ setUpClass = require_gguf_py(unittest.TestCase) # test_packer_refuses_before_writing builds GGUF fixtures
ROWS = "0 145 146 0 100 1 2 3\n1 145 146 100 100 4 5 6\n"
def table(self, version, tail="(n_expert 2, total 200)"):
diff --git a/tools/test_strata_mcp.py b/tools/test_strata_mcp.py
index 0fdb78bc8..fab2199f8 100644
--- a/tools/test_strata_mcp.py
+++ b/tools/test_strata_mcp.py
@@ -164,8 +164,12 @@ class FakeRoot(unittest.TestCase):
self.strata.disk_free = lambda p: 1000.0
self.tools = M.Tools(self.strata)
self.extra = []
+ # the tests must never see a Strata server that happens to run on the real default port on this PC
+ self._default_port = M.DEFAULT_PORT
+ M.DEFAULT_PORT = free_port()
def tearDown(self):
+ M.DEFAULT_PORT = self._default_port
for p in self.extra:
if p.poll() is None:
p.kill()