unsloth/unsloth_cli
Daniel Han 5cebc46124
Make the unsloth_cli studio tests pass in isolation (#7599)
* Make the unsloth_cli studio tests pass in isolation

Six tests in test_studio_run_parallel_flag.py and one in
test_studio_secure_flag.py only passed in a full-directory run. All of them
reach the in-venv branch of run(), which does `from state.tool_policy import
set_tool_policy`. That module lives under studio/backend, so it only imports
once something has put that directory on sys.path, and nothing in either file
does. They were relying on test_start.py, which calls
ensure_studio_backend_path() and leaks the sys.path entry, or on
test_studio_cloudflare_flag.py, which stubs the module.

Add a stub_tool_policy_state fixture in a new conftest and use it in the seven,
so the state comes from the test rather than from whatever ran first.

Every file in unsloth_cli/tests now passes on its own, and the suite is stable
across four pytest-randomly seeds.

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-07-29 01:33:19 -07:00
..
commands Studio: Write auth secret files with a trailing newline (#7576) 2026-07-29 00:50:19 -07:00
tests Make the unsloth_cli studio tests pass in isolation (#7599) 2026-07-29 01:33:19 -07:00
__init__.py tests: read checked-in files as UTF-8 instead of the platform default (#7438) 2026-07-26 23:31:56 -07:00
_inference.py Studio: detect an interrupted dependency install instead of launching a backend that cannot import (#7492) 2026-07-28 10:57:20 +02:00
_studio_deps.py Studio: detect an interrupted dependency install instead of launching a backend that cannot import (#7492) 2026-07-28 10:57:20 +02:00
_tool_policy.py Keep server-side tools enabled under --secure (#6403) 2026-06-18 05:52:40 -07:00
claude_subagent_mcp.py unsloth start: keep the local subagent unattended and out of plan mode (#7437) 2026-07-27 04:18:22 -07:00
codex_fallback_prompt.md Fix agent workspace isolation and Hermes one-shot resume (#7103) 2026-07-15 15:06:03 +02:00
codex_subagent_mcp.py Complete local subagent delegation for Codex, Claude plan mode, and Pi (#7329) 2026-07-23 20:48:30 -07:00
config.py feat(studio): add DoRA support to studio (#7315) 2026-07-24 03:24:16 -07:00
options.py CLI: fix --local-dataset being parsed as a string instead of a list (#6357) 2026-06-16 02:32:26 -07:00
pi_subagent.ts Add interactive Agents command builder (#7312) 2026-07-26 17:09:19 -07:00