Ejemplo n.º 1
0
 isInstalled = False
 if plugins.has_key(pluginName):
     try:
         plugin = plugins[pluginName]
         #            nTdebug("reloading same module just to see it change")
         reload(plugin.module)
     except ImportWarning, extraInfo:  # Disable after done debugging; can't use nTdebug yet.
         ntu.nTmessage(
             "importPlugin: Skipping reload of an optional compound (please recode to use SkipTest): %s" % extraInfo
         )
         # Internally we need to know if we're called by nosetests or by regular call.
     except SkipTest, extraInfo:
         ntu.nTmessage("importPlugin: Skipping reload report of an optional compound: %s" % extraInfo)
     except Exception:
         ntu.nTtracebackError()
         ntu.nTexception("importPlugin: A reload failed for " + pluginName)
         return None
 #    module = __import__( moduleName, globals(), locals(), [] )
 #    ntu.nTmessage('==> Attempting import plugin ' + pluginName )
 # by the manuals words:
 # "However, when a non-empty fromlist argument is given, the module named by name is returned."
 pluginCodeModulePackage = None
 try:
     # JFD changed from default to zero which means to only try absolute imports.
     pluginCodeModulePackage = __import__(pluginCodeModule, globals(), locals(), [pluginName])
     isInstalled = True
     ntu.nTdebug("importPlugin: Installed plugin: [%s]" % pluginName)
 except ImportWarning:
     ntu.nTdebug(
         "importPlugin: Skipping import of an optional plugin: [%s] (please recode to use SkipTest)" % pluginName
     )