Commits

Rémy HUBSCHER committed 9690168

Issue #12703 - Add a test for importation error

  • Participants
  • Parent commits e75fac8

Comments (0)

Files changed (2)

File Lib/packaging/tests/incorrect_module.py

+''' 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')

File Lib/packaging/tests/test_util.py

         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()