Skip to content

Commit

Permalink
Mock empty HFH repos cache instead of just helper fn return value
Browse files Browse the repository at this point in the history
  • Loading branch information
juhoinkinen committed Oct 1, 2024
1 parent caf0325 commit 80eb1b2
Showing 1 changed file with 3 additions and 2 deletions.
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

0 comments on commit 80eb1b2

Please sign in to comment.