fix: repair the Colab cell edit and point the clear test at the split resolver

Two CI failures, both mine to fix.

The warning I added to the Colab ASR cell used \n escapes inside the notebook
JSON, and they landed as real newlines, so the cell's Python had an
unterminated string and tests/test_colab_asr_setup.py could not exec it. The
block prints line by line now, with no escapes to get wrong.

test_tauri_log_clear_reports_truncate_failure patched _tauri_log_candidates,
but #1925 moved Clear onto _tauri_plugin_log_candidates, so the patch no longer
reached the code under test and the real resolver was consulted instead. It
passed on a machine with a shell log on disk and failed on a clean runner.
Patches both halves, matching the fixture in test_tauri_log_clear.py.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ypcgSsh5j2PEonSJiAU1S
This commit is contained in:
Palash Debnath
2026-09-09 13:43:17 -07:00
co-authored by Claude Opus 5
parent 8526ff56f7
commit b55098f044
2 changed files with 14 additions and 6 deletions
+6 -6
View File
@@ -682,12 +682,12 @@
"try:\n",
" import ctranslate2 # noqa: F401\n",
"except Exception as _exc:\n",
" print(\n",
" \"\n⚠️ CTranslate2 is not importable here, so the backend will fall back\"\n",
" \"\n to its PyTorch Whisper default and download that model separately.\"\n",
" f\"\n Reason: {_exc}\"\n",
" \"\n Re-run the cuDNN 8 setup cell above before continuing.\"\n",
" )\n"
" print(\"\")\n",
" print(\"WARNING: CTranslate2 is not importable here, so the backend will\")\n",
" print(\" fall back to its PyTorch Whisper default and download\")\n",
" print(\" that model separately - several more GB.\")\n",
" print(f\" Reason: {_exc}\")\n",
" print(\" Re-run the cuDNN 8 setup cell above before continuing.\")\n"
]
},
{
+8
View File
@@ -114,6 +114,14 @@ async def test_tauri_log_clear_reports_truncate_failure(monkeypatch, tmp_path, a
log = tmp_path / "webview.log"
log.write_text("data", encoding="utf-8")
monkeypatch.setattr(system, "_tauri_log_candidates", lambda: [str(log)])
# Clear now goes through the plugin-log half only, so patching the
# composite alone no longer reaches it. Patching both keeps this honest
# against the pre-split code too; without it the real resolver is
# consulted and the result depends on whether the machine running the
# test happens to have a shell log on disk.
monkeypatch.setattr(
system, "_tauri_plugin_log_candidates", lambda: [str(log)], raising=False
)
monkeypatch.setattr(
system,
"_truncate_file",