From 7291fd19acb54c98a4627edf65a00335a6c82b9f Mon Sep 17 00:00:00 2001 From: ZacharyZcR Date: Tue, 21 Jul 2026 01:34:26 +0800 Subject: [PATCH] tests: skip the fmt=5 codec tests where numpy is absent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI keeps the runtime path dependency-free, so the Python test job runs without numpy and the new codec tests errored on import. Guard the import and skip the class instead — verified both ways: 6/6 run where numpy is present, 6/6 skip cleanly where it is not. --- c/tests/test_iq3_pack.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/c/tests/test_iq3_pack.py b/c/tests/test_iq3_pack.py index fd0a10a..c2f17fd 100644 --- a/c/tests/test_iq3_pack.py +++ b/c/tests/test_iq3_pack.py @@ -9,10 +9,17 @@ import os import sys import unittest -import numpy as np +# The runtime path is dependency-free by design and CI keeps it that way, so the +# offline-tooling tests skip rather than fail where numpy is absent. +np = None +P = None +try: + import numpy as np -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "tools")) -import iq3_pack as P # noqa: E402 + sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "tools")) + import iq3_pack as P +except ImportError: # pragma: no cover - exercised only on dependency-free CI + pass def ref_decode(packed, K): @@ -43,6 +50,7 @@ def ref_decode(packed, K): return out +@unittest.skipIf(P is None, "numpy not available (offline-tooling test)") class TestIq3Pack(unittest.TestCase): def setUp(self): np.random.seed(4242)