From 85c5d8ea421805421e78d202c1105da8b7de90c4 Mon Sep 17 00:00:00 2001 From: Loïc Minier Date: Fri, 8 Apr 2011 03:54:07 +0200 Subject: Detect compression from orig tarball --- tests/05_test_detection.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/05_test_detection.py b/tests/05_test_detection.py index 4c028ff..72c9316 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) -- cgit v1.2.3