Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --trust-repo option to download CLI command #807

Merged
merged 6 commits into from
Oct 1, 2024
Prev Previous commit
Next Next commit
Mock empty HFH repos cache instead of just helper fn return value
  • Loading branch information
juhoinkinen committed Oct 1, 2024
commit 80eb1b2d440f2059ede3da4b954d4c72b5fb6e0e
5 changes: 3 additions & 2 deletions tests/test_hfh_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ def test_download_allowed_repo_in_cache(mock_is_repo_in_cache, caplog):
)


@mock.patch("annif.hfh_util._is_repo_in_cache", return_value=False)
def test_download_not_allowed(mock_is_repo_in_cache):
@mock.patch("huggingface_hub.utils._cache_manager.HFCacheInfo")
def test_download_not_allowed(mock_HFCacheInfo):
trust_repo = False
repo_id = "dummy-repo"
mock_HFCacheInfo.return_value.repos = frozenset()

with pytest.raises(OperationFailedException) as excinfo:
annif.hfh_util.check_is_download_allowed(trust_repo, repo_id)
Expand Down
Loading