Message96770
| Author |
rbcollins |
| Recipients |
rbcollins |
| Date |
2009年12月21日.21:07:15 |
| SpamBayes Score |
0.0008245624 |
| Marked as misclassified |
No |
| Message-id |
<1261429637.28.0.131724711132.issue7559@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Say I have a test module test_foo, which fails to import with
ImportError. A reason for this might be a misspelt import in that module.
TestLoader().loadTestsFromName swallows the import error and instead
crashes with:
File "/usr/lib/python2.6/unittest.py", line 584, in loadTestsFromName
parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute 'test_foo'
A better thing to do would be to keep the import error and if the next
probe is an Attribute error, reraise the import error.
An alternative would be to return a test which would then reraise the
import error permitting the test suite to be constructed and execute but
still reporting the error. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2009年12月21日 21:07:17 | rbcollins | set | recipients:
+ rbcollins |
| 2009年12月21日 21:07:17 | rbcollins | set | messageid: <1261429637.28.0.131724711132.issue7559@psf.upfronthosting.co.za> |
| 2009年12月21日 21:07:15 | rbcollins | link | issue7559 messages |
| 2009年12月21日 21:07:15 | rbcollins | create |
|