Skip to content

Fix CI: commit operation equality (hfh 1.20.0) and pytest parametrize collection error#8283

Merged
lhoestq merged 1 commit into
mainfrom
fix-ci-hfh-1.20-and-pytest-parametrize
Jun 25, 2026
Merged

Fix CI: commit operation equality (hfh 1.20.0) and pytest parametrize collection error#8283
lhoestq merged 1 commit into
mainfrom
fix-ci-hfh-1.20-and-pytest-parametrize

Conversation

@Wauplin

@Wauplin Wauplin commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Fixes two unrelated CI failures (seen e.g. in the huggingface_hub 1.21.0.rc0 test run, but the first one already affects main with the latest stable huggingface_hub).

1. tests/test_hub.py::test_delete_from_hub

Since huggingface_hub 1.20.0 (introduced in huggingface/huggingface_hub#4331), UploadInfo is no longer a dataclass and therefore CommitOperationAdd / CommitOperationDelete no longer implement value equality. Two commit operations with identical content are no longer considered equal, which broke:

assert mock_method.call_args.kwargs.get("operations") == expected_operations

with an AssertionError between two byte-identical CommitOperationAdd objects.

Updated the test to compare operations attribute by attribute (type, path_in_repo, is_folder, path_or_fileobj) instead of relying on ==.

2. tests/test_load.py collection error

TypeError: object of type 'bool' has no len()

A trailing comma in @pytest.mark.parametrize("stream_from_cache, ", [False, True]) made recent pytest versions parse it as two argnames and expect each parameter value to be a 2-tuple, failing at collection time (which errors out the whole test_load.py module). This is unrelated to huggingface_hub. Fixed by dropping the trailing comma.

🤖 Generated with Claude Code

Two unrelated CI failures:

1. tests/test_hub.py::test_delete_from_hub
   Since huggingface_hub 1.20.0 (huggingface/huggingface_hub#4331),
   `UploadInfo` is no longer a dataclass and `CommitOperationAdd`/`CommitOperationDelete`
   no longer implement value equality. Two operations with identical content are therefore
   not equal anymore, breaking the `operations == expected_operations` assertion. Compare
   operations attribute by attribute instead. This is a breaking change in huggingface_hub
   that will not be reverted upstream.

2. tests/test_load.py collection error
   A trailing comma in `@pytest.mark.parametrize("stream_from_cache, ", ...)` made recent
   pytest parse it as two argnames, raising `TypeError: object of type 'bool' has no len()`
   at collection time. Drop the trailing comma.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Wauplin Wauplin requested a review from lhoestq June 25, 2026 13:17
@Wauplin Wauplin marked this pull request as ready for review June 25, 2026 13:17
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@lhoestq lhoestq left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@lhoestq lhoestq merged commit b713dcd into main Jun 25, 2026
6 of 15 checks passed
@lhoestq lhoestq deleted the fix-ci-hfh-1.20-and-pytest-parametrize branch June 25, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants