Ticket #15114: sys-modules-none.diff
File sys-modules-none.diff, 1.3 KB (added by , 14 years ago) |
---|
-
django/utils/module_loading.py
7 7 """See if 'module' is in 'package'.""" 8 8 name = ".".join([package.__name__, module_name]) 9 9 if name in sys.modules: 10 return True 10 # None indicates a cached miss; see mark_miss() in Python/import.c. 11 return sys.modules[name] is not None 11 12 for finder in sys.meta_path: 12 13 if finder.find_module(name): 13 14 return True -
tests/regressiontests/utils/module_loading.py
25 25 self.assertFalse(module_has_submodule(test_module, 'no_such_module')) 26 26 self.assertRaises(ImportError, import_module, 'regressiontests.utils.test_module.no_such_module') 27 27 28 # Don't be confused by caching of import misses 29 import types # causes attempted import of regressiontests.utils.types 30 self.assertFalse(module_has_submodule(sys.modules['regressiontests.utils'], 'types')) 31 28 32 class EggLoader(unittest.TestCase): 29 33 def setUp(self): 30 34 self.old_path = sys.path[:]