def test_gen_patch_instructions(): index = { 'a': { 'depends': ['c', 'd'], 'features': 'd' }, 'b': { 'nane': 'blah' }, } new_index = { 'a': { 'depends': ['c', 'd', 'e'], 'features': None }, 'b': { 'nane': 'blah' }, } inst = _gen_patch_instructions(index, new_index, 'osx-64') assert inst['patch_instructions_version'] == 1 assert 'revoke' in inst assert 'remove' in inst assert 'packages' in inst assert inst['packages'] == { 'a': { 'depends': ['c', 'd', 'e'], 'features': None } } assert inst['remove'] == list(REMOVALS['osx-64'])
def do_subdir(subdir, raw_repodata_path, ref_repodata_path): with bz2.open(raw_repodata_path) as fh: raw_repodata = json.load(fh) with bz2.open(ref_repodata_path) as fh: ref_repodata = json.load(fh) new_index = _gen_new_index(raw_repodata, subdir) instructions = _gen_patch_instructions(raw_repodata, new_index, subdir) new_repodata = _apply_instructions(subdir, raw_repodata, instructions) show_record_diffs(subdir, ref_repodata, new_repodata)
def test_gen_patch_instructions(): index = { "a": { "depends": ["c", "d"], "features": "d" }, "b": { "nane": "blah" }, "c": {}, } new_index = { "a": { "depends": ["c", "d", "e"], "features": None }, "b": { "nane": "blah" }, "c": { "addthis": "yes" }, } inst = _gen_patch_instructions(index, new_index, "packages") assert inst["patch_instructions_version"] == 1 assert "revoke" in inst assert "remove" in inst assert "packages" in inst assert inst["packages"] == { "a": { "depends": ["c", "d", "e"], "features": None }, "c": { "addthis": "yes" }, }