Skip to content

Commit e92e259

Browse files
sayakpaulclaude
andcommitted
match missing-shard test on the shard filename
huggingface_hub>=1.22.0 reports a missing cached shard via IncompleteSnapshotError (repo-relative path) before diffusers' own cached-folder check (absolute path) runs, so assert on the shard's filename, which both messages contain. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent c2f9647 commit e92e259

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/models/test_modeling_common.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,11 @@ def test_local_files_only_with_sharded_checkpoint(self):
161161
repo_id, subfolder="transformer", cache_dir=tmpdir, local_files_only=True
162162
)
163163

164-
# Verify error mentions the missing shard
164+
# Verify error mentions the missing shard. `huggingface_hub>=1.22.0` reports it via
165+
# `IncompleteSnapshotError` (repo-relative path), older versions via diffusers' own check on the
166+
# cached folder (absolute path), so match on the shard's filename.
165167
error_msg = str(context.value)
166-
assert cached_shard_file in error_msg or "required according to the checkpoint index" in error_msg, (
168+
assert os.path.basename(cached_shard_file) in error_msg, (
167169
f"Expected error about missing shard, got: {error_msg}"
168170
)
169171

0 commit comments

Comments
 (0)