kaxil commented on code in PR #77089:
URL: https://github.com/apache/airflow/pull/77089#discussion_r4688670253
##########
providers/huggingface/tests/unit/huggingface/hooks/test_huggingface.py:
##########
@@ -172,3 +262,263 @@ def
test_find_commit_by_marker_scans_pull_request_refs_when_requested():
api.list_repo_refs.assert_called_once_with("org/data",
repo_type="dataset", include_pull_requests=True)
assert api.list_repo_commits.call_args_list[0].kwargs["revision"] == "main"
assert api.list_repo_commits.call_args_list[1].kwargs["revision"] ==
"refs/pr/7"
+
+
[email protected]
+async def
test_aget_token_falls_back_to_ambient_for_default_connection(monkeypatch,
mocker):
+ monkeypatch.setenv("AIRFLOW_CONN_HUGGINGFACE_DEFAULT",
'{"conn_type":"huggingface"}')
+ hook = HuggingFaceHook(None)
Review Comment:
With `HuggingFaceHook(None)`, `_aget_token` returns on its first line, so
this still never reaches the ambient fallback (and with the empty default
connection it sets, `HuggingFaceHook()` would get `False`, not `None`).
Removing the `if self._allow_ambient_fallback: return None` branch leaves the
whole suite green, though that's the path every `HuggingFaceHook()` without a
`huggingface_default` connection takes. Can this delete the env var instead,
use `HuggingFaceHook()` and assert `None`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]