summaryrefslogtreecommitdiffhomepage
path: root/tests/05_test_detection.py
diff options
context:
space:
mode:
authorLoïc Minier <lool@debian.org>2011-04-08 03:54:07 +0200
committerGuido Günther <agx@sigxcpu.org>2011-04-09 22:42:36 +0200
commit85c5d8ea421805421e78d202c1105da8b7de90c4 (patch)
tree90ccafb39e2872fe0945defe4decba640565acc5 /tests/05_test_detection.py
parent1919f2677e963a64cef2b62373f25d0cfab99e95 (diff)
Detect compression from orig tarball
Diffstat (limited to 'tests/05_test_detection.py')
-rw-r--r--tests/05_test_detection.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/05_test_detection.py b/tests/05_test_detection.py
index 4c028ff0..72c93161 100644
--- a/tests/05_test_detection.py
+++ b/tests/05_test_detection.py
@@ -5,6 +5,7 @@ import unittest
import git_buildpackage
from gbp.deb import has_orig
+from gbp.errors import GbpError
class MockGitRepository:
def __init__(self, with_branch=False, subject=None):
@@ -28,12 +29,31 @@ class TestDetection(unittest.TestCase):
def tearDown(self):
shutil.rmtree(self.tmpdir)
- def test_guess_comp_type_no_pristine_tar(self):
+ def test_guess_comp_type_no_pristine_tar_no_orig(self):
repo = MockGitRepository(with_branch=False)
guessed = git_buildpackage.guess_comp_type(
repo, 'auto', self.cp, self.tmpdir)
self.assertEqual('gzip', guessed)
+ def test_guess_comp_type_no_pristine_tar_with_orig(self):
+ open(os.path.join(self.tmpdir, 'source_1.2.orig.tar.bz2'), "w").close()
+ repo = MockGitRepository(with_branch=False)
+ guessed = git_buildpackage.guess_comp_type(
+ repo, 'auto', self.cp, self.tmpdir)
+ self.assertEqual('bzip2', guessed)
+
+ def test_guess_comp_type_no_pristine_tar_with_multiple_origs(self):
+ open(os.path.join(self.tmpdir, 'source_1.2.orig.tar.gz'), "w").close()
+ open(os.path.join(self.tmpdir, 'source_1.2.orig.tar.xz'), "w").close()
+ repo = MockGitRepository(with_branch=False)
+ self.assertRaises(
+ GbpError,
+ git_buildpackage.guess_comp_type,
+ repo,
+ 'auto',
+ self.cp,
+ self.tmpdir)
+
def test_guess_comp_type_bzip2(self):
subject = 'pristine-tar data for source_1.2-3.orig.tar.bz2'
repo = MockGitRepository(with_branch=True, subject=subject)