"""티어에 적힌 Hugging Face 저장소가 실제로 로그인 없이 받아지는지 확인한다. 저장소 이름이 틀리면 사용자 PC에서 "번역 시작"을 누를 때 401/404 로 처음 드러난다. (v0.3.0-test4: 존재하지 않는 Systran/faster-whisper-large-v3-turbo 를 가리키고 있었다.) 네트워크가 없으면 건너뛴다. """ import pytest from livesub.models.tiers import TIERS huggingface_hub = pytest.importorskip("huggingface_hub") def _repos() -> list[str]: return sorted({r for t in TIERS.values() for r in (t.asr.repo, t.mt.repo)}) def _online() -> bool: try: huggingface_hub.HfApi().model_info("Systran/faster-whisper-small", token=False) except Exception: return False return True @pytest.mark.parametrize("repo", _repos()) def test_repo_is_public_and_has_weights(repo): if not _online(): pytest.skip("Hugging Face 에 접속할 수 없음") info = huggingface_hub.HfApi().model_info(repo, token=False) assert not info.private assert not info.gated files = {s.rfilename for s in info.siblings} assert files & {"model.bin", "model.safetensors"} or any( f.endswith(".safetensors") for f in files ), f"{repo}: 가중치 파일이 없음 ({sorted(files)})"