Пример #1
0
def test_set_commit_ref_macro(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'commit')
    spec_path = dist_path.join('foo.spec')
    with dist_path.as_cwd():
        spec = specfile.Spec()
        spec.set_commit_ref_macro('86a713c35718520cb3b681260182a8388ac809f3')
        spec.save()
    common.assert_distgit(dist_path, 'commit-patched')
Пример #2
0
def test_set_commit_ref_macro(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'commit')
    spec_path = dist_path.join('foo.spec')
    with dist_path.as_cwd():
        spec = specfile.Spec()
        spec.set_commit_ref_macro('86a713c35718520cb3b681260182a8388ac809f3')
        spec.save()
    common.assert_distgit(dist_path, 'commit-patched')
Пример #3
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)
        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"
Пример #4
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"
Пример #5
0
def test_patches_base_noop_weird(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'empty-weird')
    spec_path = dist_path.join('foo.spec')
    with dist_path.as_cwd():
        spec_before = spec_path.read()
        spec = specfile.Spec()
        ver, np = spec.get_patches_base()
        assert ver == 'banana'
        assert np == 2
        spec.set_patches_base_version('banana')
        spec.save()
        spec_after = spec_path.read()
    common.assert_distgit(dist_path, 'empty-weird')
Пример #6
0
def test_patches_base_add_empty(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'empty')
    spec_path = dist_path.join('foo.spec')
    with dist_path.as_cwd():
        spec_before = spec_path.read()
        spec = specfile.Spec()
        ver, np = spec.get_patches_base()
        assert ver is None
        assert np == 0
        spec.set_patches_base_version('+2')
        spec.save()
        spec_after = spec_path.read()
    common.assert_distgit(dist_path, 'empty-ex')
Пример #7
0
def test_patches_base_noop_weird(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'empty-weird')
    spec_path = dist_path.join('foo.spec')
    with dist_path.as_cwd():
        spec_before = spec_path.read()
        spec = specfile.Spec()
        ver, np = spec.get_patches_base()
        assert ver == 'banana'
        assert np == 2
        spec.set_patches_base_version('banana')
        spec.save()
        spec_after = spec_path.read()
    common.assert_distgit(dist_path, 'empty-weird')
Пример #8
0
def test_patches_base_add_empty(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'empty')
    spec_path = dist_path.join('foo.spec')
    with dist_path.as_cwd():
        spec_before = spec_path.read()
        spec = specfile.Spec()
        ver, np = spec.get_patches_base()
        assert ver is None
        assert np == 0
        spec.set_patches_base_version('+2')
        spec.save()
        spec_after = spec_path.read()
    common.assert_distgit(dist_path, 'empty-ex')
Пример #9
0
def test_update_double_patches_base(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'double-patches')
    spec_path = dist_path.join('foo.spec')
    with dist_path.as_cwd():
        common.prep_patches_branch()
        commit_before = git('rev-parse', 'HEAD')
        with pytest.raises(rdopkg.utils.exception.DuplicatePatchesBaseError):
            update_patches('master',
                           local_patches_branch='master-patches',
                           version='1.2.3')
        commit_after = git('rev-parse', 'HEAD')
    common.assert_distgit(dist_path, 'double-patches')
    assert commit_before == commit_after, "Commit created on double patches_base (error)"
Пример #10
0
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()
        spec_before = spec_path.read()
        commit_before = git('rev-parse', 'HEAD')
        common.add_patches(extra=True)
        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"
Пример #11
0
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"
Пример #12
0
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()
        spec_before = spec_path.read()
        commit_before = git('rev-parse', 'HEAD')
        common.add_patches(extra=True)
        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"
Пример #13
0
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"
Пример #14
0
def test_update_milestone(tmpdir):
    dist_path = common.prep_spec_test(tmpdir, 'milestone')
    spec_path = dist_path.join('foo.spec')
    with dist_path.as_cwd():
        common.prep_patches_branch()
        spec_before = spec_path.read()
        commit_before = git('rev-parse', 'HEAD')
        update_patches('master',
                       local_patches_branch='master-patches',
                       version='1.2.3')
        spec_after = spec_path.read()
        commit_after = git('rev-parse', 'HEAD')
    assert spec_after == spec_before
    assert commit_before == commit_after, "Commit created for no-op"
    with dist_path.as_cwd():
        common.add_patches()
        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-milestone')
    assert commit_before != commit_after, "New commit not created"