def test_set_commit_ref_macro(tmpdir): dist_path = common.prep_spec_test(tmpdir, 'commit') with dist_path.as_cwd(): spec = specfile.Spec() spec.set_commit_ref_macro('86a713c35718520cb3b681260182a8388ac809f3') spec.save() common.assert_distgit(dist_path, 'commit-patched')
def test_update_double_patches_base(tmpdir): dist_path = common.prep_spec_test(tmpdir, 'double-patches') with dist_path.as_cwd(): common.prep_patches_branch() with pytest.raises(rdopkg.exception.DuplicatePatchesBaseError): update_patches('master', local_patches_branch='master-patches', version='1.2.3') common.assert_distgit(dist_path, 'double-patches')
def test_update_comments(tmpdir): dist_path = common.prep_spec_test(tmpdir, 'some-comments') with dist_path.as_cwd(): common.prep_patches_branch() common.add_patches(extra=True) update_patches('master', local_patches_branch='master-patches', version='1.2.3') common.assert_distgit(dist_path, 'patched-comments')
def test_update_double_patches_base(tmpdir): dist_path = common.prep_spec_test(tmpdir, 'double-patches') with dist_path.as_cwd(): common.prep_patches_branch() with pytest.raises(rdopkg.exception.LintProblemsFound): update_patches('master', local_patches_branch='master-patches', version='1.2.3') common.assert_distgit(dist_path, 'double-patches')
def test_update_dense_ex(tmpdir): dist_path = common.prep_spec_test(tmpdir, 'empty-dense-ex') with dist_path.as_cwd(): common.prep_patches_branch() common.add_patches(extra=True) update_patches('master', local_patches_branch='master-patches', version='1.2.3') common.assert_distgit(dist_path, 'patched-dense-ex')
def test_patches_base_add_empty(tmpdir): dist_path = common.prep_spec_test(tmpdir, 'empty') with dist_path.as_cwd(): spec = specfile.Spec() ver, np = spec.get_patches_base() assert ver is None assert np == 0 spec.set_patches_base_version('+2') spec.save() common.assert_distgit(dist_path, 'empty-ex')
def test_patches_base_noop_weird(tmpdir): dist_path = common.prep_spec_test(tmpdir, 'empty-weird') with dist_path.as_cwd(): spec = specfile.Spec() ver, np = spec.get_patches_base() assert ver == 'banana' assert np == 2 spec.set_patches_base_version('banana') spec.save() common.assert_distgit(dist_path, 'empty-weird')
def test_update_autosetup(tmpdir): dist_path = common.prep_spec_test(tmpdir, 'autosetup') with dist_path.as_cwd(): common.prep_patches_branch() common.add_patches(extra=True) update_patches('master', local_patches_branch='master-patches', version='1.2.3') apply_method = specfile.Spec().patches_apply_method() assert apply_method == 'autosetup' common.assert_distgit(dist_path, 'patched-autosetup')
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"
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"
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"
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() update_patches('master', local_patches_branch='master-patches', version='1.2.3') spec_after = spec_path.read() assert spec_after == spec_before 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() common.assert_distgit(dist_path, 'patched-milestone')