Skip to content

Commit

Permalink
Disable implicit token in CI (#7126)
Browse files Browse the repository at this point in the history
* Disable implicit token in CI

* Enable implicit token in set_ci_hub_access_token fixture
  • Loading branch information
albertvillanova authored Aug 26, 2024
1 parent 880a52c commit e4c87a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ def set_test_cache_config(tmp_path_factory, monkeypatch):
monkeypatch.setattr("datasets.config.EXTRACTED_DATASETS_PATH", str(test_extracted_datasets_path))


@pytest.fixture(autouse=True)
def disable_implicit_token(monkeypatch):
monkeypatch.setattr("huggingface_hub.constants.HF_HUB_DISABLE_IMPLICIT_TOKEN", True)


@pytest.fixture(autouse=True, scope="session")
def disable_tqdm_output():
datasets.disable_progress_bar()
Expand Down
4 changes: 3 additions & 1 deletion tests/fixtures/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ def ci_hub_config(monkeypatch):


@pytest.fixture
def set_ci_hub_access_token(ci_hub_config):
def set_ci_hub_access_token(ci_hub_config, monkeypatch):
# Enable implicit token
monkeypatch.setattr("huggingface_hub.constants.HF_HUB_DISABLE_IMPLICIT_TOKEN", False)
old_environ = dict(os.environ)
os.environ["HF_TOKEN"] = CI_HUB_USER_TOKEN
yield
Expand Down

0 comments on commit e4c87a6

Please sign in to comment.