summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-09-17 15:09:17 +0300
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-01-31 13:25:38 +0200
commitee896671900122814308c2ff122925d636075b0e (patch)
treebd9746353331b033b5411a2abb656e51b87fa555 /tests
parent708df663f81d8e5984b6dbf4ad14761a6ef6f2af (diff)
downloadgit-buildpackage-ee896671900122814308c2ff122925d636075b0e.tar.gz
git-buildpackage-ee896671900122814308c2ff122925d636075b0e.tar.bz2
git-buildpackage-ee896671900122814308c2ff122925d636075b0e.zip
rpm: Implement spec_from_repo() helper function
Change-Id: Ia1fb4a8be2c8e8b82f9a8a4fe55f55dc1259b7d1 Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_rpm.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/test_rpm.py b/tests/test_rpm.py
index d2fd736d..b6d1c699 100644
--- a/tests/test_rpm.py
+++ b/tests/test_rpm.py
@@ -24,7 +24,7 @@ from nose.tools import assert_raises
from gbp.errors import GbpError
from gbp.rpm import (SrcRpmFile, SpecFile, parse_srpm, NoSpecError, guess_spec,
- guess_spec_repo)
+ guess_spec_repo, spec_from_repo)
from gbp.git.repository import GitRepository
DATA_DIR = os.path.abspath(os.path.splitext(__file__)[0] + '_data')
@@ -352,7 +352,7 @@ class TestUtilityFunctions(object):
assert spec.specdir == SPEC_DIR
def test_guess_spec_repo(self):
- """Test guess_spec_repo() function"""
+ """Test guess_spec_repo() and spec_from_repo() functions"""
# Create dummy repository with some commits
repo = GitRepository.create(self.tmpdir)
with open(os.path.join(repo.path, 'foo.txt'), 'w') as fobj:
@@ -377,4 +377,10 @@ class TestUtilityFunctions(object):
assert spec.specdir == 'packaging'
assert spec.specpath == 'packaging/gbp-test.spec'
+ # Test spec_from_repo()
+ with assert_raises(NoSpecError):
+ spec_from_repo(repo, 'HEAD~1', 'packaging/gbp-test.spec')
+ spec = spec_from_repo(repo, 'HEAD', 'packaging/gbp-test.spec')
+ assert spec.specfile == 'gbp-test.spec'
+
# vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: