Skip to content

Update unit test warnings check to ignore unrelated deprecation warnings#4188

Merged
Wauplin merged 3 commits intohuggingface:mainfrom
seanses:main
May 5, 2026
Merged

Update unit test warnings check to ignore unrelated deprecation warnings#4188
Wauplin merged 3 commits intohuggingface:mainfrom
seanses:main

Conversation

@seanses
Copy link
Copy Markdown
Contributor

@seanses seanses commented May 5, 2026

The unit test test_buckets.py/test_download_bucket_files_skips_missing_first_file asserts number of warning messages emit from downloading a "non existent" bucket file is 1. Since hf-xet 1.5.0, it emits deprecation warning message from legacy APIs (upload_files, download_files, ...) so this unit test fails in the hf-xet pre-release testing workflow, e.g. in https://github.com/huggingface/huggingface_hub/actions/runs/25361805293/job/74362888965:

FAILED ../tests/test_buckets.py::test_download_bucket_files_skips_missing_first_file - assert 2 == 1
 +  where 2 = len([<WarningMessage {message : UserWarning("File 'non_existent_file.txt' not found in bucket '__DUMMY_HUB_USER__/bucket-664eb1-17779633453324'. Skipping."), category : 'UserWarning', filename : '/home/runner/work/huggingface_hub/huggingface_hub/src/huggingface_hub/hf_api.py', lineno : 13479, line : None}>, <WarningMessage {message : DeprecationWarning('hf_xet.download_files() is deprecated. Use XetSession().new_file_download_group().start_download_file() instead.'), category : 'DeprecationWarning', filename : '/home/runner/work/huggingface_hub/huggingface_hub/src/huggingface_hub/utils/_validators.py', lineno : 88, line : None}>])

This PR updates this unit test to filter out unrelated deprecation warnings.


Note

Low Risk
Low risk: changes are limited to a unit test assertion and only affect how warnings are filtered/validated during test execution.

Overview
Makes test_download_bucket_files_skips_missing_first_file resilient to extra warnings by filtering the captured warnings to only those mentioning the missing file, instead of asserting an exact warning count.

Reviewed by Cursor Bugbot for commit 0216046. Bugbot is set up for automated code reviews on this repo. Configure here.

@bot-ci-comment
Copy link
Copy Markdown

bot-ci-comment Bot commented May 5, 2026

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.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.23%. Comparing base (1daa48b) to head (0216046).
⚠️ Report is 321 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4188      +/-   ##
==========================================
+ Coverage   75.00%   77.23%   +2.23%     
==========================================
  Files         145      170      +25     
  Lines       13978    19400    +5422     
==========================================
+ Hits        10484    14984    +4500     
- Misses       3494     4416     +922     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@seanses seanses marked this pull request as ready for review May 5, 2026 09:43
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit fd8afcf. Configure here.

Comment thread setup.py Outdated
Copy link
Copy Markdown
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

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

Thanks!

Feel free to merge once hf-xet version is unpinned :)

@Wauplin Wauplin merged commit 2774771 into huggingface:main May 5, 2026
17 checks passed
@huggingface-hub-bot
Copy link
Copy Markdown
Contributor

This PR has been shipped as part of the v1.14.0 release.

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.

2 participants