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>
This commit is contained in:
parent
0ed26297ed
commit
5cebc46124
4 changed files with 31 additions and 5 deletions
2
.github/workflows/studio-backend-ci.yml
vendored
2
.github/workflows/studio-backend-ci.yml
vendored
|
|
@ -231,8 +231,6 @@ jobs:
|
|||
# Own step, not folded into the tests/ discovery above: pyproject's
|
||||
# testpaths is tests/, and this suite needs no PYTHONPATH or CUDA spoof
|
||||
# (it self-bootstraps sys.path and imports neither unsloth nor torch).
|
||||
# Run the whole directory in one invocation; some files in it are
|
||||
# order-dependent and only pass in a full-directory run.
|
||||
run: python -m pytest unsloth_cli/tests -q --tb=short
|
||||
|
||||
- name: Shell installer tests
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue