Ticket #15114: sys-modules-none.diff

File sys-modules-none.diff, 1.3 KB (added by Michael Shields, 14 years ago)
  • django/utils/module_loading.py

     
    77    """See if 'module' is in 'package'."""
    88    name = ".".join([package.__name__, module_name])
    99    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
    1112    for finder in sys.meta_path:
    1213        if finder.find_module(name):
    1314            return True
  • tests/regressiontests/utils/module_loading.py

     
    2525        self.assertFalse(module_has_submodule(test_module, 'no_such_module'))
    2626        self.assertRaises(ImportError, import_module, 'regressiontests.utils.test_module.no_such_module')
    2727
     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
    2832class EggLoader(unittest.TestCase):
    2933    def setUp(self):
    3034        self.old_path = sys.path[:]
Back to Top