summaryrefslogtreecommitdiff
path: root/tests/utils_tests/test_module_loading.py
diff options
context:
space:
mode:
authorHasan <hasan.r67@gmail.com>2016-01-18 12:15:45 +0330
committerTim Graham <timograham@gmail.com>2016-01-29 13:37:33 -0500
commit26ad01719d73823e65c0358a2ee9941e0a888a63 (patch)
tree9e458f4c3428400e0970554ce19f6ed02e862a3b /tests/utils_tests/test_module_loading.py
parent253adc2b8a52982139d40c4f55b3fd446e1cb8f3 (diff)
Refs #26022 -- Replaced six.assertRaisesRegex with assertRaisesMessage as appropriate.
Diffstat (limited to 'tests/utils_tests/test_module_loading.py')
-rw-r--r--tests/utils_tests/test_module_loading.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/utils_tests/test_module_loading.py b/tests/utils_tests/test_module_loading.py
index 7140515cb9..738d3c7d04 100644
--- a/tests/utils_tests/test_module_loading.py
+++ b/tests/utils_tests/test_module_loading.py
@@ -5,7 +5,7 @@ import unittest
from importlib import import_module
from zipimport import zipimporter
-from django.test import SimpleTestCase, modify_settings
+from django.test import SimpleTestCase, TestCase, modify_settings
from django.test.utils import extend_sys_path
from django.utils import six
from django.utils._os import upath
@@ -115,7 +115,7 @@ class EggLoader(unittest.TestCase):
import_module('egg_module.sub1.sub2.no_such_module')
-class ModuleImportTestCase(unittest.TestCase):
+class ModuleImportTestCase(TestCase):
def test_import_string(self):
cls = import_string('django.utils.module_loading.import_string')
self.assertEqual(cls, import_string)
@@ -124,7 +124,7 @@ class ModuleImportTestCase(unittest.TestCase):
with self.assertRaises(ImportError):
import_string('no_dots_in_path')
msg = 'Module "utils_tests" does not define a "unexistent" attribute'
- with six.assertRaisesRegex(self, ImportError, msg):
+ with self.assertRaisesMessage(ImportError, msg):
import_string('utils_tests.unexistent')
@@ -164,13 +164,13 @@ class AutodiscoverModulesTestCase(SimpleTestCase):
def test_validate_registry_keeps_intact(self):
from .test_module import site
- with six.assertRaisesRegex(self, Exception, "Some random exception."):
+ with self.assertRaisesMessage(Exception, "Some random exception."):
autodiscover_modules('another_bad_module', register_to=site)
self.assertEqual(site._registry, {})
def test_validate_registry_resets_after_erroneous_module(self):
from .test_module import site
- with six.assertRaisesRegex(self, Exception, "Some random exception."):
+ with self.assertRaisesMessage(Exception, "Some random exception."):
autodiscover_modules('another_good_module', 'another_bad_module', register_to=site)
self.assertEqual(site._registry, {'lorem': 'ipsum'})