Skip to content

Commit

Permalink
Fix gated repo tests (huggingface#26257)
Browse files Browse the repository at this point in the history
* Fix gated repo tests

* Apply suggestions from code review
  • Loading branch information
Wauplin authored and MKhalusova committed Sep 19, 2023
1 parent dd65294 commit 3aa2c32
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/utils/test_hub_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ def test_get_file_from_repo_local(self):

self.assertIsNone(get_file_from_repo(tmp_dir, "b.txt"))

@unittest.skip("Test is broken, fix me Wauplain!")
def test_get_file_gated_repo(self):
"""Test download file from a gated repo fails with correct message when not authenticated."""
with self.assertRaisesRegex(EnvironmentError, "You are trying to access a gated repo."):
cached_file(GATED_REPO, README_FILE, use_auth_token=False)
# All files except README.md are protected on a gated repo.
cached_file(GATED_REPO, "gated_file.txt", use_auth_token=False)

@unittest.skip("Test is broken, fix me Wauplain!")
def test_has_file_gated_repo(self):
"""Test check file existence from a gated repo fails with correct message when not authenticated."""
with self.assertRaisesRegex(EnvironmentError, "is a gated repository"):
has_file(GATED_REPO, README_FILE, use_auth_token=False)
# All files except README.md are protected on a gated repo.
has_file(GATED_REPO, "gated_file.txt", use_auth_token=False)

0 comments on commit 3aa2c32

Please sign in to comment.