Exemple #1
0
def test_filter_out(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'empty-ex-filter')
    with dist_path.as_cwd():
        common.prep_patches_branch()
        commit_before = git('rev-parse', 'HEAD')
        common.add_patches(extra=True, filtered=True)
        actions.update_patches('master',
                               local_patches_branch='master-patches',
                               version='1.2.3')
        commit_after = git('rev-parse', 'HEAD')
    common.assert_distgit(dist_path, 'patched-filter')
    assert commit_before != commit_after, "New commit not created"
def test_update_dense(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'empty-dense')
    spec_path = dist_path.join('foo.spec')
    with dist_path.as_cwd():
        common.prep_patches_branch(dist_path)
        spec_before = spec_path.read()
        commit_before = git('rev-parse', 'HEAD')
        common.add_patches(extra=True)
        actions.update_patches('master',
                               local_patches_branch='master-patches',
                               version='1.2.3')
        spec_after = spec_path.read()
        commit_after = git('rev-parse', 'HEAD')
    common.assert_distgit(dist_path, 'patched-dense')
    assert commit_before != commit_after, "New commit not created"
def test_update_dense(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'empty-dense')
    spec_path = dist_path.join('foo.spec')
    with dist_path.as_cwd():
        common.prep_patches_branch(dist_path)
        spec_before = spec_path.read()
        commit_before = git('rev-parse', 'HEAD')
        common.add_patches(extra=True)
        actions.update_patches('master',
                               local_patches_branch='master-patches',
                               version='1.2.3')
        spec_after = spec_path.read()
        commit_after = git('rev-parse', 'HEAD')
    common.assert_distgit(dist_path, 'patched-dense')
    assert commit_before != commit_after, "New commit not created"
def test_update_autosetup(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'autosetup')
    spec_path = dist_path.join('foo.spec')
    with dist_path.as_cwd():
        common.prep_patches_branch(dist_path)
        spec_before = spec_path.read()
        commit_before = git('rev-parse', 'HEAD')
        common.add_patches(extra=True)
        actions.update_patches('master',
                               local_patches_branch='master-patches',
                               version='1.2.3')
        spec_after = spec_path.read()
        commit_after = git('rev-parse', 'HEAD')
        apply_method = specfile.Spec().patches_apply_method()
    assert apply_method == 'autosetup'
    common.assert_distgit(dist_path, 'patched-autosetup')
    assert commit_before != commit_after, "New commit not created"
def test_update_git_am_buildarch_fail(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'git-am-fail')
    spec_path = dist_path.join('foo.spec')
    with dist_path.as_cwd():
        common.prep_patches_branch(dist_path)
        spec_before = spec_path.read()
        commit_before = git('rev-parse', 'HEAD')
        common.add_patches(extra=True)
        with pytest.raises(rdopkg.utils.exception.BuildArchSanityCheckFailed):
            actions.update_patches('master',
                                   local_patches_branch='master-patches',
                                   version='1.2.3')
        spec_after = spec_path.read()
        commit_after = git('rev-parse', 'HEAD')
        apply_method = specfile.Spec().patches_apply_method()
    assert apply_method == 'git-am'
    assert commit_before == commit_after, "New commit created"
def test_update_autosetup(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'autosetup')
    spec_path = dist_path.join('foo.spec')
    with dist_path.as_cwd():
        common.prep_patches_branch(dist_path)
        spec_before = spec_path.read()
        commit_before = git('rev-parse', 'HEAD')
        common.add_patches(extra=True)
        actions.update_patches('master',
                               local_patches_branch='master-patches',
                               version='1.2.3')
        spec_after = spec_path.read()
        commit_after = git('rev-parse', 'HEAD')
        apply_method = specfile.Spec().patches_apply_method()
    assert apply_method == 'autosetup'
    common.assert_distgit(dist_path, 'patched-autosetup')
    assert commit_before != commit_after, "New commit not created"
def test_update_git_am_buildarch_fail(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'git-am-fail')
    spec_path = dist_path.join('foo.spec')
    with dist_path.as_cwd():
        common.prep_patches_branch(dist_path)
        spec_before = spec_path.read()
        commit_before = git('rev-parse', 'HEAD')
        common.add_patches(extra=True)
        with pytest.raises(rdopkg.utils.exception.BuildArchSanityCheckFailed):
            actions.update_patches('master',
                                   local_patches_branch='master-patches',
                                   version='1.2.3')
        spec_after = spec_path.read()
        commit_after = git('rev-parse', 'HEAD')
        apply_method = specfile.Spec().patches_apply_method()
    assert apply_method == 'git-am'
    assert commit_before == commit_after, "New commit created"
def test_update_noop(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'patched')
    spec_path = dist_path.join('foo.spec')
    with dist_path.as_cwd():
        common.prep_patches_branch(dist_path)
        spec_before = spec_path.read()
        common.add_patches()
        actions.update_patches('master',
                               local_patches_branch='master-patches',
                               version='1.2.3')
        spec_after = spec_path.read()
        assert spec_after == spec_before
        commit_before = git('rev-parse', 'HEAD')
        actions.update_patches('master',
                               local_patches_branch='master-patches',
                               version='1.2.3')
        commit_after = git('rev-parse', 'HEAD')
    assert commit_before == commit_after, "Commit created for no-op"
def test_update_noop(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'patched')
    spec_path = dist_path.join('foo.spec')
    with dist_path.as_cwd():
        common.prep_patches_branch(dist_path)
        spec_before = spec_path.read()
        common.add_patches()
        actions.update_patches('master',
                               local_patches_branch='master-patches',
                               version='1.2.3')
        spec_after = spec_path.read()
        assert spec_after == spec_before
        commit_before = git('rev-parse', 'HEAD')
        actions.update_patches('master',
                               local_patches_branch='master-patches',
                               version='1.2.3')
        commit_after = git('rev-parse', 'HEAD')
    assert commit_before == commit_after, "Commit created for no-op"