-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add handling of struct.error during Image.verify #78
Comments
It looks like the latest version now raises either SyntaxError or IOError :-/ See python-pillow/Pillow#1805. Not sure if that's been released yet. I don't really want to test every version of Pillow with every different version of Python for just this one test. Maybe we could use mock side effects to test that each option is handled? |
I tried writing some tests for this and they all passed without me doing anything. Looks like the only place we call @melinath is your proposal to replace |
@chigby This ticket was based on a reported (or experienced) bug. I don't remember the details any more. We except every subclass of Exception, you're right. Maybe |
Oh, the place it was failing was itself a test case which was looking for a specific error. |
I guess just updating that test case to make sure the exception is an Exception subclass would be fine. |
Ahhh, okay, the problem is in the test. I can fix that. |
…versions of PIL 1. Use mock objects to simulate the different errors PIL raises when it has problems verifying an image. 2. There is one test that does the verification without mocking, this is sort of future-proofing in case they change the errors again. 3. Removed the assertion on Image.verify -- this is not really our code to test. 4. Removed `except Exception` which I think casts too broad a net. If we think it is necessary I can put it back. Fixed #78
See python-pillow/Pillow#1755. Pillow now throws struct.error in certain situations where we expect something else (specifically IndexError). Though that may or may not be the proper behavior, there are at least 3 versions of Pillow out with this behavior; we should handle it.
The text was updated successfully, but these errors were encountered: