Skip to content

Check the exception type in test_failure of IgzipDecompressor - #305

Merged
rhpvorderman merged 1 commit into
pycompression:developfrom
ptweezy:test-failure-error-type
Oct 28, 2026
Merged

rhpvorderman merged 1 commit into
pycompression:developfrom
ptweezy:test-failure-error-type

Conversation

@ptweezy

@ptweezy ptweezy commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

test_failure uses pytest.raises(Exception), which also passes on the SystemError that Python raises when decompress() returns NULL without setting an exception. CPython's test_bz2, where the test comes from, also uses Exception. This PR checks for igzip_lib.IsalError, which decompress() raises for invalid data.

To test it, I removed the isal_inflate_error(err) call for invalid data in decompress_buf(). The old test passes, and the new one fails with SystemError.

This PR changes only tests, so it has no CHANGELOG entry.

Checklist

  • Pull request details were added to CHANGELOG.rst
  • Documentation was updated (if needed)

pytest.raises(Exception) also passes on the SystemError that Python raises when decompress() returns NULL without setting an exception.
@rhpvorderman

Copy link
Copy Markdown
Collaborator

Thanks!

@rhpvorderman
rhpvorderman merged commit 262ad1f into pycompression:develop Oct 28, 2026
22 checks passed
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