mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #15525 -- Custom template tags loading breaks whenever templatetags is a python file
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16703 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -18,6 +18,8 @@ class DefaultLoader(unittest.TestCase):
|
||||
def test_loader(self):
|
||||
"Normal module existence can be tested"
|
||||
test_module = import_module('regressiontests.utils.test_module')
|
||||
test_no_submodule = import_module(
|
||||
'regressiontests.utils.test_no_submodule')
|
||||
|
||||
# An importable child
|
||||
self.assertTrue(module_has_submodule(test_module, 'good_module'))
|
||||
@@ -40,6 +42,11 @@ class DefaultLoader(unittest.TestCase):
|
||||
import types # causes attempted import of regressiontests.utils.types
|
||||
self.assertFalse(module_has_submodule(sys.modules['regressiontests.utils'], 'types'))
|
||||
|
||||
# A module which doesn't have a __path__ (so no submodules)
|
||||
self.assertFalse(module_has_submodule(test_no_submodule, 'anything'))
|
||||
self.assertRaises(ImportError, import_module,
|
||||
'regressiontests.utils.test_no_submodule.anything')
|
||||
|
||||
class EggLoader(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.old_path = sys.path[:]
|
||||
|
||||
Reference in New Issue
Block a user