diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2013-01-11 16:41:38 +0200 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-06-05 14:20:06 +0300 |
commit | 821251cbd8d7076e49729ac88eabd92265caedec (patch) | |
tree | fa534727e095d009cf0de865adf09dbfbbaf12a6 /tests/test_rpm.py | |
parent | aecfc649d6825acc147f3009577bfeb688bdc874 (diff) | |
download | git-buildpackage-821251cbd8d7076e49729ac88eabd92265caedec.tar.gz git-buildpackage-821251cbd8d7076e49729ac88eabd92265caedec.tar.bz2 git-buildpackage-821251cbd8d7076e49729ac88eabd92265caedec.zip |
rpm.SpecFile: drop the internal 'patches' structure
To get rid of duplicate data tracking. Also, add test for testing the
macro expansion of patch and source names.
Also add tests for SpecFile.patchseries.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'tests/test_rpm.py')
-rw-r--r-- | tests/test_rpm.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/test_rpm.py b/tests/test_rpm.py index 68886e86..728c8872 100644 --- a/tests/test_rpm.py +++ b/tests/test_rpm.py @@ -200,6 +200,7 @@ class TestSpecFile(object): spec.protected('_delete_tag')('source', 0) spec.protected('_delete_tag')('patch', 0) spec.protected('_delete_tag')('patch', -1) + assert spec.protected('_patches')() == {} prev = spec.protected('_delete_tag')('invalidtag', None) with assert_raises(GbpError): @@ -249,8 +250,28 @@ class TestSpecFile(object): assert val['value'] == rval, ("'%s:' is '%s', expecting '%s'" % (name, val['value'], rval)) assert spec.ignorepatches == [] + # Check patch numbers and patch filenames + patches = {patch['num']: patch['linevalue'] for patch in + spec.protected('_tags')['patch']['lines']} + assert patches == {0: 'my_patch0', -1: 'my_patch'} - assert spec.patches.keys() == [0, -1] + def test_patch_series(self): + """Test the getting the patches as a patchseries""" + spec_filepath = os.path.join(SPEC_DIR, 'gbp-test-native.spec') + spec = SpecFileTester(spec_filepath) + + assert len(spec.patchseries()) == 0 + spec.update_patches(['1.patch', '2.patch', '3.patch']) + assert len(spec.patchseries()) == 3 + spec.protected('_gbp_tags')['ignore-patches'].append({'args': "0"}) + spec.update_patches(['4.patch']) + assert len(spec.patchseries()) == 1 + assert len(spec.patchseries(ignored=True)) == 2 + spec.protected('_delete_special_macro')('patch', 0) + assert len(spec.patchseries(ignored=True)) == 1 + series = spec.patchseries(unapplied=True, ignored=True) + assert len(series) == 2 + assert os.path.basename(series[-1].path) == '4.patch' class TestUtilityFunctions(object): |