def load_module(self, fullname):
"""This method is called by Python if CustomImporter.find_module
does not return None. fullname is the fully-qualified name
of the module/package that was requested."""
if fullname in sys.modules:
return sys.modules[fullname]
else:
logger.debug('Importing Mock Module: {}'.format(fullname))
# mod = imp.new_module(fullname)
# import pdb; pdb.set_trace()
mod = MockObject(fullname=fullname)
mod.__loader__ = self
mod.__file__ = fullname
mod.__path__ = [fullname]
mod.__name__ = fullname
sys.modules[fullname] = mod
return mod # This gives errors
评论列表
文章目录