Opened 16 years ago

Closed 16 years ago

Last modified 12 years ago

#7727 closed (fixed)

Obscure failure if PIL is not there

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

Description

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 by Maciej Fijalkowski, 16 years ago

Cc: fijall@… added

comment:2 by Russell Keith-Magee, 16 years ago

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 by Russell Keith-Magee, 16 years ago

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 by Maciej Fijalkowski, 16 years ago

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/fields.py#509 catches all exceptions and raises ValidationErrors instead of reporting correctly that PIL is broken.

comment:5 by Russell Keith-Magee, 16 years ago

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 by Jacob, 12 years ago

milestone: 1.0 beta

Milestone 1.0 beta deleted

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