Example #1
0
def test_build_filelist_missing_file(context, task_dfn):
    expected_paths = set()
    for a in task_dfn['payload']['upstreamArtifacts']:
        abs_path = os.path.join(context.config['work_dir'], 'cot', a['taskId'],
                                a['paths'][0])
        expected_paths.add(abs_path)
        os.makedirs(os.path.dirname(abs_path))
        with open(abs_path, 'w') as f:
            # Make file exist
            print('something', file=f)
    task_dfn['payload']['upstreamArtifacts'][-1]['taskId'] = "MISSINGTASK"
    context.task = task_dfn
    with pytest.raises(TaskVerificationError):
        task.build_filelist(context)
Example #2
0
def test_build_filelist_missing_file(context, task_dfn):
    expected_paths = set()
    for a in task_dfn["payload"]["upstreamArtifacts"]:
        abs_path = os.path.join(context.config["work_dir"], "cot", a["taskId"],
                                a["paths"][0])
        expected_paths.add(abs_path)
        os.makedirs(os.path.dirname(abs_path))
        with open(abs_path, "w") as f:
            # Make file exist
            print("something", file=f)
    task_dfn["payload"]["upstreamArtifacts"][-1]["taskId"] = "MISSINGTASK"
    context.task = task_dfn
    with pytest.raises(TaskVerificationError):
        task.build_filelist(context)
Example #3
0
def build_locales_context(context):
    langpack_info = []
    for f in build_filelist(context):
        current_info = get_langpack_info(context, f)
        langpack_info.append(current_info)
    context.locales = {
        locale_info['locale']: {
            'unsigned': locale_info['unsigned'],
            'version': locale_info['version'],
            'id': locale_info['id'],
        }
        for locale_info in langpack_info
    }
Example #4
0
def build_locales_context(context):
    langpack_info = []
    for f in build_filelist(context):
        current_info = get_langpack_info(context, f)
        langpack_info.append(current_info)
    context.locales = {
        locale_info["locale"]: {
            "unsigned": locale_info["unsigned"],
            "version": locale_info["version"],
            "id": locale_info["id"]
        }
        for locale_info in langpack_info
    }
Example #5
0
def test_build_filelist(context, task_dfn):
    expected_paths = set()
    for a in task_dfn['payload']['upstreamArtifacts']:
        abs_path = os.path.join(context.config['work_dir'], 'cot', a['taskId'],
                                a['paths'][0])
        expected_paths.add(abs_path)
        os.makedirs(os.path.dirname(abs_path))
        with open(abs_path, 'w') as f:
            # Make file exist
            print('something', file=f)
    context.task = task_dfn
    file_list = task.build_filelist(context)
    assert len(file_list) == len(task_dfn['payload']['upstreamArtifacts'])
    assert expected_paths == set(file_list)
    assert isinstance(file_list, type([]))
Example #6
0
def test_build_filelist(context, task_dfn):
    expected_paths = set()
    for a in task_dfn["payload"]["upstreamArtifacts"]:
        abs_path = os.path.join(context.config["work_dir"], "cot", a["taskId"],
                                a["paths"][0])
        expected_paths.add(abs_path)
        os.makedirs(os.path.dirname(abs_path))
        with open(abs_path, "w") as f:
            # Make file exist
            print("something", file=f)
    context.task = task_dfn
    file_list = task.build_filelist(context)
    assert len(file_list) == len(task_dfn["payload"]["upstreamArtifacts"])
    assert expected_paths == set(file_list)
    assert isinstance(file_list, type([]))