Пример #1
0
def test_patch_add(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'patched')
    with dist_path.as_cwd():
        common.prep_patches_branch()
        common.add_patches()
        commit_before = git('rev-parse', 'HEAD')
        common.add_n_patches(3)
        rdopkg('patch', '-l')
        commit_after = git('rev-parse', 'HEAD')
        git_clean = git.is_clean()
        common.norm_changelog()
    common.assert_distgit(dist_path, 'patch-add')
    assert commit_before != commit_after, "New commit not created"
    assert git_clean, "git not clean after action"
Пример #2
0
def _test_patch_noop(tmpdir, distgit, cmd):
    dist_path = common.prep_spec_test(tmpdir, distgit)
    with dist_path.as_cwd():
        common.prep_patches_branch()
        common.add_patches()
        # regen patch files in order for hashes to match git
        rdopkg('update-patches', '--amend')
        commit_before = git('rev-parse', 'HEAD')
        rdopkg(*cmd)
        commit_after = git('rev-parse', 'HEAD')
        git_clean = git.is_clean()
    common.assert_distgit(dist_path, distgit)
    assert commit_before == commit_after, "New commit created for noop"
    assert git_clean, "git not clean after action"
Пример #3
0
def test_patch_add(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'patched')
    with dist_path.as_cwd():
        common.prep_patches_branch()
        common.add_patches()
        commit_before = git('rev-parse', 'HEAD')
        common.add_n_patches(3)
        rdopkg('patch', '-l')
        commit_after = git('rev-parse', 'HEAD')
        git_clean = git.is_clean()
        common.norm_changelog()
    common.assert_distgit(dist_path, 'patch-add')
    assert commit_before != commit_after, "New commit not created"
    assert git_clean, "git not clean after action"
Пример #4
0
def _test_patch_noop(tmpdir, distgit, cmd):
    dist_path = common.prep_spec_test(tmpdir, distgit)
    with dist_path.as_cwd():
        common.prep_patches_branch()
        common.add_patches()
        # regen patch files in order for hashes to match git
        rdopkg('update-patches', '--amend')
        commit_before = git('rev-parse', 'HEAD')
        rdopkg(*cmd)
        commit_after = git('rev-parse', 'HEAD')
        git_clean = git.is_clean()
    common.assert_distgit(dist_path, distgit)
    assert commit_before == commit_after, "New commit created for noop"
    assert git_clean, "git not clean after action"
Пример #5
0
def _test_patch_regen(tmpdir, distgit, distgit_after,
                      cmd, norm_changelog=True):
    dist_path = common.prep_spec_test(tmpdir, distgit)
    with dist_path.as_cwd():
        common.prep_patches_branch()
        common.add_patches()
        commit_before = git('rev-parse', 'HEAD')
        rdopkg(*cmd)
        commit_after = git('rev-parse', 'HEAD')
        git_clean = git.is_clean()
        if norm_changelog:
            common.norm_changelog()
    common.assert_distgit(dist_path, distgit_after)
    assert commit_before != commit_after, \
        "New commit not created after patch regen"
    assert git_clean, "git not clean after action"
Пример #6
0
def _test_new_version(asset, dir, steps):
    dist_path = common.prep_spec_test(dir, asset)
    log.log.setLevel(log.WARN)

    with dist_path.as_cwd():
        common.prep_patches_branch()
        for new_version, spec_version, spec_release_parts, spec_milestone \
                in steps:
            commit_before = git('rev-parse', 'HEAD')
            common.add_patches(tag=new_version)
            rdopkg('new-version', '-l', '-d', new_version)

            # after
            commit_after = git('rev-parse', 'HEAD')
            common.assert_spec_version(spec_version, spec_release_parts,
                                       spec_milestone)
            assert commit_before != commit_after
Пример #7
0
def _test_new_version(asset, dir, steps):
    dist_path = common.prep_spec_test(dir, asset)
    spec_path = dist_path.join('foo.spec')
    log.log.setLevel(log.WARN)

    with dist_path.as_cwd():
        common.prep_patches_branch()
        for new_version, spec_version, spec_release_parts, spec_milestone \
                in steps:
            commit_before = git('rev-parse', 'HEAD')
            common.add_patches(tag=new_version)
            rdopkg('new-version', '-l', '-d', new_version)

            # after
            commit_after = git('rev-parse', 'HEAD')
            common.assert_spec_version(spec_version, spec_release_parts,
                                       spec_milestone)
            assert commit_before != commit_after
Пример #8
0
def _test_patch_regen(tmpdir,
                      distgit,
                      distgit_after,
                      cmd,
                      norm_changelog=True):
    dist_path = common.prep_spec_test(tmpdir, distgit)
    with dist_path.as_cwd():
        common.prep_patches_branch()
        common.add_patches()
        commit_before = git('rev-parse', 'HEAD')
        rdopkg(*cmd)
        commit_after = git('rev-parse', 'HEAD')
        git_clean = git.is_clean()
        if norm_changelog:
            common.norm_changelog()
    common.assert_distgit(dist_path, distgit_after)
    assert commit_before != commit_after, \
        "New commit not created after patch regen"
    assert git_clean, "git not clean after action"
Пример #9
0
def _test_patch(asset, version, dir):
    dist_path = common.prep_spec_test(dir, asset)
    spec_path = dist_path.join('foo.spec')
    log.log.setLevel(log.WARN)

    with dist_path.as_cwd():
        spec_version, spec_release_parts, spec_milestone = version
        tag = spec_version
        if spec_milestone:
            tag += spec_milestone

        common.prep_patches_branch(tag=tag)
        commit_before = git('rev-parse', 'HEAD')
        common.add_patches()

        rdopkg('patch', '-l')
        # after
        commit_after = git('rev-parse', 'HEAD')

        common.assert_spec_version(spec_version, spec_release_parts,
                                   spec_milestone)
        assert commit_before != commit_after
Пример #10
0
def _test_patch(asset, version, dir):
    dist_path = common.prep_spec_test(dir, asset)
    log.log.setLevel(log.WARN)

    with dist_path.as_cwd():
        spec_version, spec_release_parts, spec_milestone = version
        tag = spec_version
        if spec_milestone:
            tag += spec_milestone

        common.prep_patches_branch(tag=tag)
        commit_before = git('rev-parse', 'HEAD')
        common.add_patches()

        rdopkg('patch', '-l')
        # after
        commit_after = git('rev-parse', 'HEAD')

        common.assert_spec_version(spec_version, spec_release_parts,
                                   spec_milestone)
        assert commit_before != commit_after, "No commit created"
        prev = git('rev-parse', 'HEAD~')
        assert prev == commit_before, "Multiple commits created"
Пример #11
0
def test_actions_continue_short():
    r = rdopkg('-c')
    assert r == 1, "-c succeeded with no state"
Пример #12
0
def test_actions_availability():
    r = rdopkg('actions')
    assert r == 0, "Some action functions are NOT AVAILABLE"
Пример #13
0
def test_actions_continue_long():
    r = rdopkg('--continue')
    assert r == 1, "--continue succeeded with no state"