def test_modules():
    """tests presence of required modules"""
    from askbot import REQUIREMENTS
    # flatten requirements into file-like string
    req_text = '\n'.join(REQUIREMENTS.values())
    import requirements
    parsed_requirements = requirements.parse(req_text)
    for req in parsed_requirements:
        pip_path = unparse_requirement(req)
        mod_name = find_mod_name(req.name)
        try_import(mod_name, pip_path)
        test_specs(req)
def test_modules():
    """tests presence of required modules"""
    from askbot import REQUIREMENTS
    #flatten requirements into file-like string
    req_text = '\n'.join(REQUIREMENTS.values())
    import requirements
    parsed_requirements = requirements.parse(req_text)
    for req in parsed_requirements:
        pip_path = unparse_requirement(req)
        mod_name = find_mod_name(req.name)
        try_import(mod_name, pip_path)
        test_specs(req)
def test_modules():
    """tests presence of required modules"""
    from askbot import REQUIREMENTS
    for module_name, pip_path in REQUIREMENTS.items():
        try_import(module_name, pip_path)
def find_mod_name(req_name):
    from askbot import REQUIREMENTS
    req2mod = dict([(get_req_name_from_spec(v), k)
                    for (k, v) in REQUIREMENTS.items()])
    return req2mod[req_name]
def find_mod_name(req_name):
    from askbot import REQUIREMENTS
    req2mod = dict([(get_req_name_from_spec(v), k) for (k, v) in REQUIREMENTS.items()])
    return req2mod[req_name]