From f4f36a0d2d3be8e16fe6d6a69e8c2ca9c14e5741 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 28 Jul 2026 21:35:04 -0700 Subject: [PATCH] Anchor the bnb bind assertion on the symbol, not the module alias (#7590) #7578 and #7580 landed within a minute of each other and compose correctly in kernels/utils.py, but the source-text assertion #7578 added does not: it looked for the literal "bnb.functional.lib" under the guard, and #7580 renamed that binding to "bnb_functional.lib" to survive a half-imported bitsandbytes. Git merged both cleanly because they touch different lines, so the break only shows at test time. Match "lib.cdequantize_blockwise_fp32" instead. That still pins the binds to the guard, which is what the test is for, and no longer breaks when the module alias changes. Co-authored-by: unslothai --- tests/python/test_bitsandbytes_kernel_readiness.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/python/test_bitsandbytes_kernel_readiness.py b/tests/python/test_bitsandbytes_kernel_readiness.py index db6ec74e57..fe595f150d 100644 --- a/tests/python/test_bitsandbytes_kernel_readiness.py +++ b/tests/python/test_bitsandbytes_kernel_readiness.py @@ -155,7 +155,10 @@ def test_the_ctypes_binds_are_gated_on_the_same_verdict(): "if bnb is None or not native_kernels_ready(bnb, DEVICE_TYPE):" in source ), "the ctypes bind block must take the _bnb_required branch on a dead library too" guarded = source.split("if bnb is None or not native_kernels_ready(bnb, DEVICE_TYPE):")[1] - assert "bnb.functional.lib" in guarded, "the binds must sit under that guard" + # Anchor on the symbol, not the module alias: #7580 renamed the binding from + # `bnb.functional.lib` to `bnb_functional.lib`, which is exactly the kind of rename + # this assertion should survive. + assert "lib.cdequantize_blockwise_fp32" in guarded, "the binds must sit under that guard" def test_the_kernel_check_reads_the_submodule_not_the_parent_attribute():