Kaydet (Commit) c2b4967e authored tarafından Tomasz Kontusz's avatar Tomasz Kontusz Kaydeden (comit) Tim Graham

Fixed ImportError message in utils.module_loading.import_string()

üst e5033dcb
......@@ -23,7 +23,7 @@ def import_string(dotted_path):
return getattr(module, class_name)
except AttributeError:
msg = 'Module "%s" does not define a "%s" attribute/class' % (
dotted_path, class_name)
module_path, class_name)
six.reraise(ImportError, ImportError(msg), sys.exc_info()[2])
......
......@@ -115,7 +115,9 @@ class ModuleImportTestCase(unittest.TestCase):
# Test exceptions raised
self.assertRaises(ImportError, import_string, 'no_dots_in_path')
self.assertRaises(ImportError, import_string, 'utils_tests.unexistent')
msg = 'Module "utils_tests" does not define a "unexistent" attribute'
with six.assertRaisesRegex(self, ImportError, msg):
import_string('utils_tests.unexistent')
@modify_settings(INSTALLED_APPS={'append': 'utils_tests.test_module'})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment