#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 , 16 years ago
Cc: | added |
---|
comment:2 by , 16 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 16 years ago
milestone: | → 1.0 beta |
---|---|
Resolution: | → worksforme |
Status: | new → closed |
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 , 16 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
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 , 16 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
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.