예제 #1
0
def test_project_bad_name():
    with pytest.raises(Exception):
        env = ProjectEnv("not a real project name")

    empty_env = ProjectEnv.from_string('')
    assert empty_env == None
    return
예제 #2
0
def _run_smoke_test_cmd(arg_map):
    """
    translates arguments from commandline to calls to python methods. Input is
    the output from argparse.parse_args(), output is an exit code indicating if
    the compilation succeeded.
    """
    project_root_dir = arg_map['project_root_dir']
    project_env_name = arg_map['project']
    project_env = ProjectEnv.from_string(project_env_name)
    target_site_name = arg_map['site']
    target_site = NestSite.from_string(target_site_name)
    exit_code = _run_smoke_test(project_env, target_site)
    return exit_code
예제 #3
0
def _run_seed_users_cmd(arg_map):
    """
    translates arguments from commandline to calls to python methods. Input is
    the output from argparse.parse_args(), output is an exit code indicating if
    the job succeeded.
    """
    project_root_dir = arg_map['project_root_dir']
    project_env_name = arg_map['project']
    project_env = ProjectEnv.from_string(project_env_name)
    runlevel_name = arg_map['runlevel']
    runlevel = RunLevel.from_string(runlevel_name)
    #target_site_name = arg_map['site']
    #target_site = NestSite.from_string(target_site_name)
    exit_code = _run_seed_users_script(project_env, runlevel)
    return exit_code
예제 #4
0
def _run_compile_cmd(arg_map):
    """
    translates arguments from commandline to calls
    to python methods. Input is the output from
    argparse.parse_args(), output is an exit code
    indicating if the compilation succeeded. 
    """
    code_type = arg_map['code_type']
    project_root_dir = arg_map['project_root_dir']
    project_env_name = arg_map['project']
    runlevel_name = arg_map['runlevel']
    project_env = ProjectEnv.from_string(project_env_name)
    runlevel = RunLevel.from_string(runlevel_name)
    exit_code = _compile(project_root_dir, code_type, project_env, runlevel)
    return exit_code
예제 #5
0
def test_project_instances():
    knoweng_env = ProjectEnv.knoweng_instance()
    mmbdb_env = ProjectEnv.mmbdb_instance()

    knoweng_rt = ProjectEnv(knoweng_env.get_project_name())
    mmbdb_rt = ProjectEnv(mmbdb_env.get_project_name())

    assert knoweng_env == knoweng_rt
    assert knoweng_env == knoweng_env
    assert not knoweng_env == mmbdb_env
    assert mmbdb_env == mmbdb_rt

    s = (str(knoweng_env))
    print(s)
    assert s.endswith('knoweng')

    assert knoweng_env == ProjectEnv.from_string('KnowEng')
    return
예제 #6
0
def _run_docker_cmd(arg_map):
    """
    translates arguments from commandline to calls to python methods. Input is
    the output from argparse.parse_args(), output is an exit code indicating if
    the compilation succeeded.
    """
    project_root_dir = arg_map['project_root_dir']
    action = arg_map['action']
    project_env_name = arg_map['project']
    project_env = ProjectEnv.from_string(project_env_name)
    target_site_name = arg_map['site']
    target_site = NestSite.from_string(target_site_name)
    runlevel_name = arg_map['runlevel']
    runlevel = RunLevel.from_string(runlevel_name)
    service = arg_map['service']
    exit_code = _docker_action(action, service, project_env, \
        runlevel, target_site, project_root_dir)
    return exit_code
예제 #7
0
def _run_seed_cmd(arg_map):
    """
    translates arguments from commandline to calls to python methods. Input is
    the output from argparse.parse_args(), output is an exit code indicating if
    the job succeeded.
    """
    project_root_dir = arg_map['project_root_dir']
    project_env_name = arg_map['project']
    project_env = ProjectEnv.from_string(project_env_name)
    target_site_name = arg_map['site']
    target_site = NestSite.from_string(target_site_name)
    flavor_name = arg_map['flavor']
    subsample_raw = arg_map['subsample']
    subsample_lower = subsample_raw.lower()
    if subsample_lower == 'true':
        subsample = True
    else:
        subsample = False
    exit_code = _run_seed_script(project_env, target_site, flavor_name,
                                 subsample)
    return exit_code