This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Daniel.Waterworth
Recipients Daniel.Waterworth
Date 2010-02-07.13:19:27
SpamBayes Score 1.3172926e-05
Marked as misclassified No
Message-id <1265548769.63.0.955560962057.issue7872@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2010-02-07 13:19:29Daniel.Waterworthsetrecipients: + Daniel.Waterworth
2010-02-07 13:19:29Daniel.Waterworthsetmessageid: <1265548769.63.0.955560962057.issue7872@psf.upfronthosting.co.za>
2010-02-07 13:19:27Daniel.Waterworthlinkissue7872 messages
2010-02-07 13:19:27Daniel.Waterworthcreate