--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Lib/packaging/tests/incorrect_module.py Mon Oct 17 18:07:23 2011 +0200 @@ -0,0 +1,9 @@ +''' Incorrect module to test packaging.util.resolve_name ''' + +class MyError(Exception): + def __init__(self, value): + self.value = value + def __str__(self): + return repr(self.value) + +raise MyError('This module has an error inside') diff -r e75fac897f6c Lib/packaging/tests/test_util.py --- a/Lib/packaging/tests/test_util.py Sat Aug 20 16:04:56 2011 +0200 +++ b/Lib/packaging/tests/test_util.py Mon Oct 17 18:07:23 2011 +0200 @@ -398,6 +398,10 @@ self.assertRaises(ImportError, resolve_name, "packaging.tests.test_util.UtilTestCase." "nonexistent_attribute") + self.assertRaisesRegexp(ImportError, + 'This module has an error inside', + resolve_name, + "packaging.tests.incorrect_module") def test_import_nested_first_time(self): tmp_dir = self.mkdtemp()