Skip to content

Fixed catching warnings #8505

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

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
radarhere added a commit to radarhere/Pillow that referenced this pull request Feb 1, 2025
radarhere added a commit to radarhere/Pillow that referenced this pull request Feb 1, 2025
fdintino pushed a commit to fdintino/Pillow that referenced this pull request Feb 3, 2025
* Removed skip_unless_feature on methods when class is already skipped

* Test speed less than slowest and greater than fastest

* Updated type hints

* Only access angle when AVIF_TRANSFORM_IROT flag is present

* Added AVIF_ROOT

* Only define normalize_quantize_value if it will be used

* Build libavif after libjpeg

* Use rgb.rowBytes in overflow check

* Group EXIF info

* Removed __loaded

* If brew is not installed, use /usr prefix

* Sort AVIF codecs alphabetically

* Updated rav1e license

* Fixed catching warning, as per python-pillow#8505

* Simplified code

* Fixed typos

* Test further scenarios

* Use y* to parse bytes

---------

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