tools/utils.py
def check_required_modules(required_modules, verbose=True):
    """ Function checks for Python modules which should be "importable"
        before test suite can be used.
        @return returns True if all modules are installed already
    """
    import imp
    not_installed_modules = []
    for module_name in required_modules:
        try:
            imp.find_module(module_name)
        except ImportError:
            # We also test against a rare case: module is an egg file
            try:
                __import__(module_name)
            except ImportError as exc:
                not_installed_modules.append(module_name)
                if verbose:
                    print "Error: %s" % exc

    if verbose:
        if not_installed_modules:
            print ("Warning: Module(s) %s not installed. Please install " + \
                   "required module(s) before using this script.")\
                % (', '.join(not_installed_modules))

    if not_installed_modules:
        return False
    else:
        return True
 Function checks for Python modules which should be "importable"
        before test suite can be used.
        @return returns True if all modules are installed already
    
Function checks for Python modules which should be "importable"
before test suite can be used.
@return returns True if all modules are installed already
Function checks for Python modules which should be " importable " before test suite can be used . @return returns True if all modules are installed already
def check_required_modules(required_modules, verbose=True):
    import imp
    not_installed_modules = []
    for module_name in required_modules:
        try:
            imp.find_module(module_name)
        except ImportError:
            try:
                __import__(module_name)
            except ImportError as exc:
                not_installed_modules.append(module_name)
                if verbose:
                    print "Error: %s" % exc
    if verbose:
        if not_installed_modules:
            print ("Warning: Module(s) %s not installed. Please install " + \
                   "required module(s) before using this script.")\
                % (', '.join(not_installed_modules))
    if not_installed_modules:
        return False
    else:
        return True
def check_required_modules ( required_modules , verbose = True ) : import imp not_installed_modules = [ ] for module_name in required_modules : try : imp . find_module ( module_name ) except ImportError : try : __import__ ( module_name ) except ImportError as exc : not_installed_modules . append ( module_name ) if verbose : print "Error: %s" % exc if verbose : if not_installed_modules : print ( "Warning: Module(s) %s not installed. Please install " + "required module(s) before using this script." ) % ( ', ' . join ( not_installed_modules ) ) if not_installed_modules : return False else : return True
Function checks for Python modules which should be "importable"
before test suite can be used.
Function checks for Python modules which should be " importable " before test suite can be used .
""" Function checks for Python modules which should be "importable"
        before test suite can be used.
        @return returns True if all modules are installed already
    """ # We also test against a rare case: module is an egg file
required_modules
verbose