Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify warnings in a with block to avoid flaky tests #31893

Merged
merged 2 commits into from
Jul 10, 2024
Merged

Modify warnings in a with block to avoid flaky tests #31893

merged 2 commits into from
Jul 10, 2024

Conversation

ydshieh
Copy link
Collaborator

@ydshieh ydshieh commented Jul 10, 2024

What does this PR do?

Avoid test_bad_generation_config_fail_early failing.

This is because another test method modify some property of warning module.

@ydshieh ydshieh changed the title Avi Modify warnings in a with block to avoid flaky tests Jul 10, 2024
@ydshieh ydshieh requested a review from amyeroberts July 10, 2024 15:25

# warning should be emitted for duplicated callbacks
with patch("transformers.trainer_callback.logger.warning") as warn_mock:
with warnings.catch_warnings():
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

just put the body inside this with

Copy link
Collaborator

@amyeroberts amyeroberts left a comment

Choose a reason for hiding this comment

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

Ooooffff - nasty bug 😬 Thanks for digging into this and fixing!

@ydshieh
Copy link
Collaborator Author

ydshieh commented Jul 10, 2024

I need some therapy after all of this 😅 😰

@HuggingFaceDocBuilderDev

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.

@ydshieh ydshieh merged commit 080e14b into main Jul 10, 2024
20 of 22 checks passed
@ydshieh ydshieh deleted the fix_flaky branch July 10, 2024 15:56
amyeroberts pushed a commit to amyeroberts/transformers that referenced this pull request Jul 19, 2024
…#31893)

* fix

* [test_all] check before merge

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
MHRDYN7 pushed a commit to MHRDYN7/transformers that referenced this pull request Jul 23, 2024
…#31893)

* fix

* [test_all] check before merge

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
zucchini-nlp pushed a commit to zucchini-nlp/transformers that referenced this pull request Jul 24, 2024
…#31893)

* fix

* [test_all] check before merge

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
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.

None yet

3 participants