unsloth/tests/studio
Lee Jackson d7594ec10f
Fix Windows no-torch setup (#7511)
* Fix Windows no-torch setup

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix no-torch env normalization on Windows

* Accept on for Windows no-torch mode

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Keep no-torch mode across studio update on Windows

Guarding the direct torch/Triton install made `install.ps1 --no-torch`
actually produce a torch-free venv, which then broke the next
`unsloth studio update`. That path exports no UNSLOTH_NO_TORCH, so
$NoTorchMode was false, the stale-venv check read the missing torch as a
broken venv, and setup tried to delete the venv it was running out of:

  [ERROR] Could not remove stale venv: Access to the path 'python.exe' is denied.

That teardown can never succeed there, because setup.ps1 runs via
unsloth.exe out of that same venv. The same gap also let the shared
dependency pass reinstall torch from PyPI, unpinned, into a GGUF-only
environment.

install_python_stack.py now records the mode in the install manifest and
setup.ps1 reads it back when no env var is exported, then re-exports a
canonical value for the dependency pass (setup.ps1 drops the manifest
before invoking it, so the child cannot repeat the lookup). The key is
additive and MANIFEST_SCHEMA is unchanged, so existing manifests stay
valid and a missing key keeps today's behaviour.

Also:
- read_manifest() caught only OSError, but UnicodeDecodeError is a
  ValueError. That is now on the installer's import path, so a manifest
  re-saved as ANSI or truncated mid-write would abort every install.
- The env predicate now trims surrounding whitespace, matching the
  Python side.
- The Windows update smoke workflow asserts the update leaves the venv
  GGUF-only, which is what would have caught this.

Known follow-up, pre-existing: an install killed between the manifest
drop and the dependency pass leaves no recorded mode, so a later update
still walks the stale-venv path. Closing that needs a marker the
installer never drops.

* Persist no-torch mode in a marker the dependency pass cannot drop

The install manifest alone was not enough. Both setup.ps1 and
install_python_stack.py remove it before every dependency pass, and it is
only rewritten on success, so a no-torch install interrupted in between
left nothing recording the mode. The next update then resolved no-torch
as false, read the expected missing torch as a stale venv, and tried to
delete the environment whose python.exe was running it, which leaves the
install unrepairable from the CLI.

Add .unsloth-no-torch next to the existing .unsloth-studio-owned marker,
written before the pass and cleared when torch is wanted. setup.ps1
writes it as soon as the mode resolves, so the window between the
manifest drop and its own torch install is covered too.

Read order stays manifest key first, then marker, so migrating out of
no-torch is never blocked by a marker an earlier run left behind. Neither
present still reads as "install torch", so nothing changes for installs
made before either existed.

Also adds the AGPL-3.0 header the new test file was missing.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: danielhanchen <unslothai@gmail.com>
2026-07-28 05:54:25 -07:00
..
install Fix Windows no-torch setup (#7511) 2026-07-28 05:54:25 -07:00
load_freeze tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
_playwright_robust.py Replace standalone Studio wording with Unsloth (#7221) 2026-07-19 00:47:04 -07:00
playwright_chat_ime_i18n.py tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
playwright_chat_ui.py tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
playwright_extra_ui.py Studio UI test: recover from voice-picker renderer crash, scoped to macOS runners 2026-07-23 21:54:41 -07:00
playwright_model_config.py fix(studio): honor run settings on initial model load (#7346) (#7351) 2026-07-24 23:27:47 -07:00
playwright_ui_font_scale.py Fix the CPU-only ROCm routing errors and two font-scale UI flakes (#7469) 2026-07-26 04:48:49 -07:00
run_real_mlx_smoke.py Replace standalone Studio wording with Unsloth (#7221) 2026-07-19 00:47:04 -07:00
studio_api_smoke.py tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
test_auth_form_input_count.py tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
test_cached_model_path_selection.py Feat/model picker per model config v2 (#7207) 2026-07-20 22:53:22 -07:00
test_cancel_atomicity.py feat(studio): run chats in parallel in the Chat tab (#7455) 2026-07-28 04:40:38 -07:00
test_cancel_id_wiring.py tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
test_chat_preset_builtin_invariants.py tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
test_chat_preset_load_config.py feat(studio): presets include load settings (#7347) (#7352) 2026-07-24 02:23:43 -07:00
test_chat_prompt_variables.py tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
test_chat_response_details_ui_contract.py tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
test_chat_thinking_compact_layout.py Studio: drive UI font size through a typography scale instead of the root font size (#7359) 2026-07-23 01:26:56 -07:00
test_chat_title_generation.py tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
test_ci_shell_suite_coverage.py AMD: CI coverage for recent fixes, plus three wrong gfx ids (#7431) 2026-07-25 18:58:02 -05:00
test_cli_repo_variant.py Reduce and tighten comments and docstrings across the test suite (#6429) 2026-06-18 01:07:09 -07:00
test_cli_run_alias.py tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
test_cli_studio_defaults.py tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
test_cli_studio_stop_windows.py Replace standalone Studio wording with Unsloth (#7221) 2026-07-19 00:47:04 -07:00
test_compact_dropdown_submenus.py Studio: UI font size scales all text consistently without moving layout (#7355) 2026-07-23 00:44:42 -07:00
test_composer_rtl_bidi_attribute.py tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
test_deep_research_frontend_contract.py feat(studio): run chats in parallel in the Chat tab (#7455) 2026-07-28 04:40:38 -07:00
test_desktop_reliability_frontend_contract.py Fix image and file paste in Studio desktop (#7543) 2026-07-28 13:46:51 +02:00
test_export_output_path_contract.py tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
test_first_turn_thread_identity.py feat(studio): run chats in parallel in the Chat tab (#7455) 2026-07-28 04:40:38 -07:00
test_frontend_dep_removal.py tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
test_generation_length_ui_contract.py Studio: prevent empty responses after model thinking (#7418) 2026-07-24 17:01:12 -07:00
test_gpu_inference_smoke.py Feat/model picker per model config v2 (#7207) 2026-07-20 22:53:22 -07:00
test_hardware_dispatch_matrix.py Replace standalone Studio wording with Unsloth (#7221) 2026-07-19 00:47:04 -07:00
test_hf_token_validation_tick_contract.py Studio: show HF token tick only after validation (#7268) 2026-07-21 03:53:11 -07:00
test_install_rollback_lifecycle.ps1 Installer: restore interrupted updates and clean stale rollback environments (#7342) 2026-07-23 01:29:53 -07:00
test_is_mlx_dispatch_gate.py tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
test_llama_cpp_wall_clock_cap.py tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
test_locale_root_direction_contract.py Replace standalone Studio wording with Unsloth (#7221) 2026-07-19 00:47:04 -07:00
test_mlx_training_worker_behaviors.py tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
test_model_picker_contracts.py Studio: keep automatic model loading toast visible until completion (#7425) 2026-07-28 00:16:28 -03:00
test_node_decision.ps1 Replace standalone Studio wording with Unsloth (#7221) 2026-07-19 00:47:04 -07:00
test_node_probe_guard.ps1 Studio: use an isolated Node.js for the frontend build instead of replacing the system Node/npm (#6533) 2026-06-21 21:17:29 -07:00
test_pdf_qa_recipe_contract.py Fix PDF-grounded QA recipe for QLoRA (#7107) 2026-07-26 20:19:53 +03:00
test_remote_connection_models_contract.py fix(studio): persist connection model selections for remote clients (#7298) 2026-07-23 19:11:50 -07:00
test_resolve_cuda_toolkit.ps1 Windows installer: fix DiskPart UAC mid-install, drive-root cache, and spurious unsloth.exe rename warning (#6296) 2026-06-22 03:09:08 -07:00
test_reveal_file_manager.py Feat/model picker per model config v2 (#7207) 2026-07-20 22:53:22 -07:00
test_settings_compact_overflow_contract.py Fix Settings layout overflow (#7167) 2026-07-16 03:12:09 -07:00
test_setup_pin_stale.ps1 install: let UNSLOTH_TORCH_INDEX_FAMILY / _URL override CUDA wheel detection (#6692) 2026-07-20 00:58:52 -07:00
test_stop_running_chats_prompt_contract.py feat(studio): run chats in parallel in the Chat tab (#7455) 2026-07-28 04:40:38 -07:00
test_stream_cancel_registration_timing.py feat(studio): run chats in parallel in the Chat tab (#7455) 2026-07-28 04:40:38 -07:00
test_studio_gguf_export_script_pin.py tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
test_studio_text_descender_clipping.py tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
test_sync_allow_scripts_pins.py Studio: auto-sync allowScripts pins after dependency bumps (#6136) 2026-06-10 02:35:37 -07:00
test_torch_flavor.ps1 install: let UNSLOTH_TORCH_INDEX_FAMILY / _URL override CUDA wheel detection (#6692) 2026-07-20 00:58:52 -07:00
test_torch_index_pin_hardening.ps1 install: let UNSLOTH_TORCH_INDEX_FAMILY / _URL override CUDA wheel detection (#6692) 2026-07-20 00:58:52 -07:00
test_ui_font_scale_contract.py Studio UI font-scale test: normalise paths so the allowlists work on Windows (#7434) 2026-07-27 12:39:35 -05:00
test_uninstall_dual_install_icon.ps1 Windows installer: fix DiskPart UAC mid-install, drive-root cache, and spurious unsloth.exe rename warning (#6296) 2026-06-22 03:09:08 -07:00
test_usage_examples_agent_detection_contract.py feat: detect installed coding agent CLIs in Studio settings (#6909) 2026-07-08 05:26:50 -07:00
test_usage_examples_model_source_contract.py Studio: tighten the comments added by the OpenAI model-admission work (#7501) 2026-07-27 05:59:03 -07:00
test_voice_settings_select_width.py Studio: UI font size scales all text consistently without moving layout (#7355) 2026-07-23 00:44:42 -07:00
test_xpu_spoof_pipeline.py Add Intel XPU support to Unsloth Studio (#4724) 2026-07-24 02:22:07 -03:00