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

Fixed catching warnings #8505

Merged
merged 1 commit into from
Oct 26, 2024
Merged

Fixed catching warnings #8505

merged 1 commit into from
Oct 26, 2024

Conversation

radarhere
Copy link
Member

https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests states

To ensure that no warnings are emitted, use:

def test_warning():
    with warnings.catch_warnings():
        warnings.simplefilter("error")
        ...

However, in #6076, I decided not to add warnings.simplefilter("error"). I've now concluded that was a mistake, and that this doesn't turn warnings into errors as intended - if I add warnings.warn("This should cause a failure"), the test suite still passes. Restoring simplefilter, only then does it fail like it should.

@hugovk hugovk merged commit 35ddbb4 into python-pillow:main Oct 26, 2024
46 checks passed
@radarhere radarhere deleted the warnings branch October 26, 2024 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants