Skip to content

Commit 6b943ec

Browse files
hynky1999Hynek Kydlicekclefourrier
authored
skip tests if secrets not provided (#304)
Co-authored-by: Hynek Kydlicek <[email protected]> Co-authored-by: Clémentine Fourrier <[email protected]>
1 parent 3dd7d50 commit 6b943ec

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

tests/fixtures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
@pytest.fixture
3535
def testing_empty_hf_org_id(org_id: str = TESTING_EMPTY_HF_ORG_ID):
3636
old_token = os.getenv("HF_TOKEN")
37-
os.environ["HF_TOKEN"] = os.getenv("HF_TEST_TOKEN")
37+
os.environ["HF_TOKEN"] = os.getenv("HF_TEST_TOKEN") or ""
3838

3939
def list_repos(org_id: str):
4040
return list(hf_api.list_models(author=org_id)) + list(hf_api.list_datasets(author=org_id))

tests/logging/test_evaluation_tracker.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ def test_no_details_output(mock_evaluation_tracker: EvaluationTracker):
126126
assert not details_dir.exists()
127127

128128

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

0 commit comments

Comments
 (0)