tools tests: align test_setup_risk's WSL mock with install() (the KV-streaming rule test failed inside WSL)

RulesAgreeWithTheWrittenConfig.test_the_streaming_rule_is_the_flag_setup_writes runs setup.main() through
test_setup_golden's install(), which mocks is_wsl() to False, and then asked setup.kv_streaming_wanted() outside
that mock. Inside WSL the real is_wsl() is True, so the rule answered "no streaming" while the config setup wrote
for the mocked PC has --kv-resident, and the test failed at its first 131072 case (Q2_0, int8, auto). With is_wsl()
the same on both sides, setup and the rule agree in all 54 cases, inside WSL and out.

The test method now runs under the same is_wsl mock as install(), the test-only fix the unsloth tests got for #974
(d1ec32b). setup.py is unchanged; where is_wsl() is already False (Windows, native Linux) the test runs as before.

Tests: python3 tools/test_setup_risk.py (WSL2, Python 3.12.3: was FAILED (failures=1), now 40 tests OK); the other
27 tools/test_setup_*.py files give the same results as before.
This commit is contained in:
chaog992 authored and Niko1221 committed 2026-10-09 15:22:14 +02:00
1 parent bafc8dd556
commit efaa87aba2
1 file changed
+1
+1
View File
@@ -488,6 +488,7 @@ class RulesAgreeWithTheWrittenConfig(unittest.TestCase):
def go(self, ram, cards, model, *flags):
return install(ram, cards, ["--family", "qwen", "--model", model, "--no-start", *flags])
@mock.patch.object(setup, "is_wsl", lambda: False) # #974: not WSL, as in install()
def test_the_streaming_rule_is_the_flag_setup_writes(self):
for model, ctx, kv, choice in itertools.product(("Q2_0", "IQ3_XXS", "IQ3_S"), ("32768", "131072"),
("int8", "q4_0", "k8v4"), ("auto", "on", "off")):