MCPcopy
hub / github.com/kserve/kserve / test_download_reads_env_patterns

Function test_download_reads_env_patterns

python/storage/test/test_hf_storage.py:100–115  ·  view source on GitHub ↗
(mock_snapshot_download)

Source from the content-addressed store, hash-verified

98
99@mock.patch("huggingface_hub.snapshot_download")
100def test_download_reads_env_patterns(mock_snapshot_download):
101 uri = "hf://example.com/model"
102
103 with mock.patch.dict(
104 os.environ,
105 {
106 "STORAGE_ALLOW_PATTERNS": '["*.safetensors"]',
107 "STORAGE_IGNORE_PATTERNS": "*.bin,*.gguf",
108 },
109 ):
110 Storage.download(uri, out_dir="/tmp/out")
111
112 mock_snapshot_download.assert_called_once()
113 call_kwargs = mock_snapshot_download.call_args[1]
114 assert call_kwargs.get("allow_patterns") == ["*.safetensors"]
115 assert call_kwargs.get("ignore_patterns") == ["*.bin", "*.gguf"]
116
117
118@mock.patch("huggingface_hub.snapshot_download")

Callers

nothing calls this directly

Calls 2

getMethod · 0.80
downloadMethod · 0.45

Tested by

no test coverage detected