test(setup): validate file lists and isolate token fixtures

This commit is contained in:
Palash Debnath
2026-09-17 20:13:38 +05:30
parent 1ef42a6b21
commit 4b3e998de3
3 changed files with 8 additions and 4 deletions
+2 -1
View File
@@ -25,7 +25,6 @@ os.environ.setdefault("OMNIVOICE_DISABLE_FILE_LOG", "1")
import pytest
from services.token_resolver import ResolvedToken
@pytest.fixture
@@ -88,6 +87,7 @@ def _drive_segmented(download, monkeypatch, tmp_path, resolved):
def test_segmented_install_sends_the_bearer_string_to_every_consumer(
download, monkeypatch, tmp_path
):
from services.token_resolver import ResolvedToken
seen = _drive_segmented(
download,
monkeypatch,
@@ -122,6 +122,7 @@ def test_a_token_record_would_build_a_broken_authorization_header():
header; given the record it produces a malformed one that also inlines the
raw secret. This is the failure #2163 reported as a 401.
"""
from services.token_resolver import ResolvedToken
from services.segmented_download import _auth_headers
url = "https://huggingface.co/pyannote/speaker-diarization-3.1/resolve/main/config.yaml"
+5 -2
View File
@@ -55,7 +55,7 @@ def test_config_only_entries_declare_the_files_that_complete_them():
if not m.get("config_only"):
continue
required = m.get("config_required_files")
assert required, f"{m['repo_id']}: config_only needs config_required_files"
assert isinstance(required, list) and required, f"{m['repo_id']}: config_only needs a nonempty config_required_files list"
assert all(
isinstance(name, str) and name.strip() for name in required
), f"{m['repo_id']}: blank entry in config_required_files"
@@ -68,7 +68,10 @@ def test_dependency_declarations_are_installable():
for dependency in m.get("dependencies") or ():
rid = dependency.get("repo_id")
assert rid and _REPO_RE.match(rid), f"malformed dependency repo_id: {rid!r}"
assert dependency.get("required_files"), (
required = dependency.get("required_files")
assert isinstance(required, list) and required and all(
isinstance(name, str) and name.strip() for name in required
), (
f"{m['repo_id']}{rid}: dependency needs required_files"
)
+1 -1
View File
@@ -25,7 +25,6 @@ os.environ.setdefault("OMNIVOICE_DISABLE_FILE_LOG", "1")
import pytest
from services.token_resolver import ResolvedToken
PIPELINE = "pyannote/speaker-diarization-3.1"
@@ -45,6 +44,7 @@ def _install_pyannote(download, monkeypatch, tmp_path):
Returns (snapshot_download kwargs per call, emitted SSE events).
"""
from services.token_resolver import ResolvedToken
import huggingface_hub
from services import hf_revisions, performance_profiles, token_resolver
from utils import hf_progress