Message98997
The problem is that when you import a module which is inside a package via 'loadTestsFromName' in unittest.TestLoader. If the imported module raises a ImportError this is read to mean that the module itself is unavailable.
To illustrate this I have a small test-case. First run the file runtests.py in python or python3. Next uncomment the first line in test/test.py and run again. The error I receive is:
Traceback (most recent call last):
File "runtests.py", line 3, in <module>
suite = unittest.TestLoader().loadTestsFromName("test.test")
File "/usr/lib/python2.6/unittest.py", line 584, in loadTestsFromName
parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute 'test'
Whereas I believe this should raise an "ImportError: No module named none_existant_module", just like it does when you try to import the module directly.
This would make the error more descriptive and therefore bugs of this nature easier to track down. |
|
Date |
User |
Action |
Args |
2010-02-07 13:19:29 | Daniel.Waterworth | set | recipients:
+ Daniel.Waterworth |
2010-02-07 13:19:29 | Daniel.Waterworth | set | messageid: <1265548769.63.0.955560962057.issue7872@psf.upfronthosting.co.za> |
2010-02-07 13:19:27 | Daniel.Waterworth | link | issue7872 messages |
2010-02-07 13:19:27 | Daniel.Waterworth | create | |
|