Fine-tune LLMs from one YAML. Layer streaming trains an 8B model on a 4 GB laptop GPU.
Python cliconsumer-gpudpofine-tuningggufhuggingfacellmllmopslocal-ailocal-llmloralow-vrammachine-learningollamapeftpythonpytorchqlorasfttransformers
fix(tests): strip ANSI/wrap before asserting the #808 guard stayed silent (#1377)
Y.B.2d3a78d7b367
diff --git a/tests/test_issue1352_narrow_terminal_guard.py b/tests/test_issue1352_narrow_terminal_guard.pynew file mode 100644index 00000000..74d162d5--- /dev/null+++ b/tests/test_issue1352_narrow_terminal_guard.py@@ -0,0 +1,35 @@+"""The #808 silence checks must not read raw captured output (#1352).++Rich wraps the loader's warning at the render width, so+``"read by nothing" not in capsys.readouterr().out`` passes while the warning+is printed whenever the line break lands inside the phrase (all four ``warn``+cases at ``COLUMNS=50``). Those checks go through ``_plain(...)``; this scan+fails if either one goes back to raw output, without editing any source file.+"""++from __future__ import annotations++import re+from pathlib import Path++_GUARDED = Path(__file__).with_name("test_issue808_staged_config_fields.py")+_RAW_NEGATIVE = re.compile(r"\bnot\s+in\s+capsys\.readouterr\(\)\.(?:out|err)\b")+_PLAIN_CHECK = '"read by nothing" not in _plain(capsys.readouterr().out)'+++def test_808_negative_checks_do_not_read_raw_output() -> None:+ lines = _GUARDED.read_text(encoding="utf-8").splitlines()+ offenders = [+ f"{_GUARDED.name}:{number}: {line.strip()}"+ for number, line in enumerate(lines, start=1)+ if _RAW_NEGATIVE.search(line)+ ]+ assert not offenders, (+ "a negative substring check on raw captured output passes when Rich wraps "+ "the phrase; route it through _plain(...):\n" + "\n".join(offenders)+ )+++def test_808_negative_checks_are_still_there() -> None:+ # The scan above is vacuous if the checks are deleted rather than reverted.+ assert _GUARDED.read_text(encoding="utf-8").count(_PLAIN_CHECK) >= 2diff --git a/tests/test_issue808_staged_config_fields.py b/tests/test_issue808_staged_config_fields.pyindex e543f068..83ec6228 100644--- a/tests/test_issue808_staged_config_fields.py+++ b/tests/test_issue808_staged_config_fields.py@@ -299,7 +299,7 @@ class TestLoaderStagedFieldIntegration:) -> None:monkeypatch.setattr(loader, "STAGED_FIELD_SEVERITY", severity)loader.load_config_from_string(_valid_with_data(**{field: spelling}))- assert "read by nothing" not in capsys.readouterr().out+ assert "read by nothing" not in _plain(capsys.readouterr().out)@pytest.mark.parametrize("severity", ["warn", "error"])def test_load_config_file_default_equivalent_spelling_loads_silently(@@ -309,7 +309,7 @@ class TestLoaderStagedFieldIntegration:cfg_file = tmp_path / "soup.yaml"cfg_file.write_text(_valid_with_data(split_thinking="'false'", video_dir="''"))loader.load_config(cfg_file)- assert "read by nothing" not in capsys.readouterr().out+ assert "read by nothing" not in _plain(capsys.readouterr().out)@pytest.mark.parametrize("severity", ["warn", "error"])def test_convergence_rel_tol_scientific_notation_unwired_tunable_loads_silently(