Skip to content

Commit

Permalink
skip tests if secrets not provided (#304)
Browse files Browse the repository at this point in the history
Co-authored-by: Hynek Kydlicek <kydliceh.hynek@gmail.com>
Co-authored-by: Clémentine Fourrier <22726840+clefourrier@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 15, 2024
1 parent 3dd7d50 commit 6b943ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
@pytest.fixture
def testing_empty_hf_org_id(org_id: str = TESTING_EMPTY_HF_ORG_ID):
old_token = os.getenv("HF_TOKEN")
os.environ["HF_TOKEN"] = os.getenv("HF_TEST_TOKEN")
os.environ["HF_TOKEN"] = os.getenv("HF_TEST_TOKEN") or ""

def list_repos(org_id: str):
return list(hf_api.list_models(author=org_id)) + list(hf_api.list_datasets(author=org_id))
Expand Down
4 changes: 4 additions & 0 deletions tests/logging/test_evaluation_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ def test_no_details_output(mock_evaluation_tracker: EvaluationTracker):
assert not details_dir.exists()


@pytest.mark.skipif(
reason="Secrets are not available in this environment",
condition=os.getenv("HF_TEST_TOKEN") is None,
)
@pytest.mark.evaluation_tracker(push_to_hub=True, hub_results_org=TESTING_EMPTY_HF_ORG_ID)
def test_push_to_hub_works(testing_empty_hf_org_id, mock_evaluation_tracker: EvaluationTracker, mock_datetime):
# Prepare the dummy data
Expand Down

0 comments on commit 6b943ec

Please sign in to comment.