Opened 10 years ago

Closed 10 years ago

Last modified 7 years ago

#7727 closed (fixed)

Obscure failure if PIL is not there

Reported by: Maciej Fijalkowski Owned by: nobody
Component: Forms Version: master
Severity: Keywords:
Cc: fijall@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


model_forms tests fail with obscure doctest errors when PIL is not there. Instead of saying "PIL not here" it will happily explode
on you with "expected True got False". I'm not sure what's the way to skip doctests, but this is troublesome even for someone who does not run tests.

Change History (6)

comment:1 Changed 10 years ago by Maciej Fijalkowski

Cc: fijall@… added

comment:2 Changed 10 years ago by Russell Keith-Magee

Triage Stage: UnreviewedAccepted

The way to skip doctests is to break the sensitive doctest string into a separate string, and only concatenate the extra string onto the actual test string if PIL is available. The fixtures modeltest gives an example for a doctest that doesn't run under MySQL; an analogous approach should work for PIL.

comment:3 Changed 10 years ago by Russell Keith-Magee

milestone: 1.0 beta
Resolution: worksforme
Status: newclosed

When I disable PIL, I don't get any failures. Looking at the code, if PIL is missing, the test should revert to a simple FileField test. Can you clarify (1) which test is failing, and (2) what other test conditions could be causing the failure.

comment:4 Changed 10 years ago by Maciej Fijalkowski

Resolution: worksforme
Status: closedreopened

Wrong specification. If PIL is there, but _imaging is not there. This is the case ie. on top of pypy, where pure python module can be imported, but C extension cannot. It raises ImportError, but newforms/ catches all exceptions and raises ValidationErrors instead of reporting correctly that PIL is broken.

comment:5 Changed 10 years ago by Russell Keith-Magee

Resolution: fixed
Status: reopenedclosed

(In [8016]) Fixed #7727 -- Improved the checks for import failure when using PIL. Under PyPy, you can import the PIL module, but when you try to use it, the underlying _imaging module will not be available. Thanks to Maciej Fijalkowski (fijal) for the report and suggested fix.

comment:6 Changed 7 years ago by Jacob

milestone: 1.0 beta

Milestone 1.0 beta deleted

Note: See TracTickets for help on using tickets.
Back to Top