unsloth/tests/saving/language_models
Daniel Han 68e5c3f04b
tests: make pytest tests collect cleanly and drop the deleted QVQ registry mirror (#8206)
* tests: make `pytest tests` collect cleanly and drop the deleted QVQ registry mirror

Collection was interrupted by 17 errors, so nothing after them ran, and
tests/test_model_registry.py::test_model_registration[qwen] was red against
the live Hub.

Registry:
- unsloth/QVQ-72B-Preview no longer exists on the Hub. Authenticated as an
  unsloth org member the API answers 404 and an org-wide search returns only
  unsloth/QVQ-72B-Preview-bnb-4bit, so it is not private and not gated (a
  gated repo still serves public metadata). Drop QuantType.NONE from the QVQ
  meta; the bnb-4bit mirror and the upstream Qwen/QVQ-72B-Preview stay.
- The registry check now treats only RepositoryNotFoundError as "missing".
  Every other hub error (429, 5xx, DNS, timeout) skips the test instead of
  reporting all 129 models missing.

Collection:
- tests/saving files with no test items are standalone GPU scripts whose body
  runs at import, so bare collection downloaded checkpoints, trained and
  pushed to the Hub. They now call require_opt_in() and are visible skips
  unless UNSLOTH_RUN_SAVING_SCRIPTS=1. Running them directly is unchanged.
- Four filenames contained a dot, which pytest's importer reads as a package
  separator; renamed to underscores.
- tests/test_raw_text.py left its datasets stub in sys.modules for the rest
  of the session, which broke collection of tests/utils/test_packing.py. The
  stub is now restored after raw_text is loaded.
- The two sentencepiece tests imported the legacy
  transformers.utils.sentencepiece_model_pb2, which fails on protobuf >= 4.
  Use convert_slow_tokenizer.import_protobuf(), the accessor the code under
  test uses.
- tests/test_collection_hygiene.py guards all three regressions.

tests --collect-only: 7629 collected + 17 errors in 214s (exit 2) ->
7703 collected, 0 errors in 3s (exit 0).

* [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-08-08 20:03:55 -07:00
..
test_merge_4bit_validation.py tests: make pytest tests collect cleanly and drop the deleted QVQ registry mirror (#8206) 2026-08-08 20:03:55 -07:00
test_merge_model_perplexity_llama_3_2.py tests: make pytest tests collect cleanly and drop the deleted QVQ registry mirror (#8206) 2026-08-08 20:03:55 -07:00
test_merge_model_perplexity_mistral.py tests: make pytest tests collect cleanly and drop the deleted QVQ registry mirror (#8206) 2026-08-08 20:03:55 -07:00
test_merge_model_perplexity_phi_4.py tests: make pytest tests collect cleanly and drop the deleted QVQ registry mirror (#8206) 2026-08-08 20:03:55 -07:00
test_merged_model_perplexity_llama_3_1_8b.py tests: make pytest tests collect cleanly and drop the deleted QVQ registry mirror (#8206) 2026-08-08 20:03:55 -07:00
test_merged_model_perplexity_qwen_2_5.py tests: make pytest tests collect cleanly and drop the deleted QVQ registry mirror (#8206) 2026-08-08 20:03:55 -07:00
test_push_to_hub_merged.py tests: make pytest tests collect cleanly and drop the deleted QVQ registry mirror (#8206) 2026-08-08 20:03:55 -07:00
test_push_to_hub_merged_sharded_index_file.py tests: make pytest tests collect cleanly and drop the deleted QVQ registry mirror (#8206) 2026-08-08 20:03:55 -07:00
test_save_merged_grpo_model.py tests: make pytest tests collect cleanly and drop the deleted QVQ registry mirror (#8206) 2026-08-08 20:03:55 -07:00