aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2017-01-17 20:10:00 +0100
committerGuido Günther <agx@sigxcpu.org>2017-01-17 20:11:01 +0100
commit1140886c80d5ef029bfd7b37b9ff8a24f07e6a69 (patch)
tree50907fe22435da93a1c1c55a96637f58cafa9020 /tests
parent4eb8c383ad862cbf1fc6c3f7b86400869079035b (diff)
buildpackage: Don't set a compression level if unset and make this the default
This allows compressors to use the their default compression level. Only applies when not using pristine-tar. Thanks: Antoine Beaupré for investigating Closes: #820846
Diffstat (limited to 'tests')
-rw-r--r--tests/04_test_submodules.py6
-rw-r--r--tests/component/deb/test_buildpackage.py24
2 files changed, 24 insertions, 6 deletions
diff --git a/tests/04_test_submodules.py b/tests/04_test_submodules.py
index 5cd8610..fcd00ba 100644
--- a/tests/04_test_submodules.py
+++ b/tests/04_test_submodules.py
@@ -127,11 +127,11 @@ def test_create_tarballs():
# Tarball with submodules
changelog = {"Source": "test", "Upstream-Version": "0.1"}
ok_(buildpackage.git_archive(REPO, changelog, str(TMPDIR), "HEAD", "bzip2",
- "9", True))
+ 9, True))
# Tarball without submodules
changelog = {"Source": "test", "Upstream-Version": "0.2"}
ok_(buildpackage.git_archive(REPO, changelog, str(TMPDIR), "HEAD", "bzip2",
- "9", False))
+ 9, False))
def test_create_zip_archives():
@@ -143,7 +143,7 @@ def test_create_zip_archives():
ok_('test/test_submodule/testfile' in contents)
git_archive_single('HEAD', 'without-submodules.zip', 'test',
- '', '', '', 'zip')
+ '', None, '', 'zip')
contents = ls_zip('without-submodules.zip')
ok_('test/test_submodule/testfile' not in contents)
diff --git a/tests/component/deb/test_buildpackage.py b/tests/component/deb/test_buildpackage.py
index 2e4cef6..49db96d 100644
--- a/tests/component/deb/test_buildpackage.py
+++ b/tests/component/deb/test_buildpackage.py
@@ -1,6 +1,6 @@
# vim: set fileencoding=utf-8 :
#
-# (C) 2015,2016 Guido Günther <agx@sigxcpu.org>
+# (C) 2015-2017 Guido Günther <agx@sigxcpu.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,6 +17,7 @@
# <http://www.gnu.org/licenses/>
import os
+import subprocess
from tests.component import (ComponentTestBase,
ComponentTestGitRepository)
@@ -147,8 +148,7 @@ class TestBuildpackage(ComponentTestBase):
self._test_buildpackage('hello-debhelper',
'dsc-3.0',
'2.8-1',
- ['--git-export-dir=../foo/bar'],
- )
+ ['--git-export-dir=../foo/bar'])
ok_(os.path.exists('../foo/bar'))
def test_argument_quoting(self):
@@ -171,3 +171,21 @@ class TestBuildpackage(ComponentTestBase):
'--git-cleaner=/bin/true',
'../arg with spaces'])
ok_(ret == 0, "Building the package failed")
+
+ def test_tarball_default_compression(self):
+ """Test that we use defaults for compression if not given (#820846)"""
+ self._test_buildpackage('hello-debhelper',
+ 'dsc-3.0',
+ '2.8-1',
+ ['--git-no-pristine-tar'])
+ out = subprocess.check_output(["file", "../hello-debhelper_2.8.orig.tar.gz"])
+ ok_("max compression" not in out)
+
+ def test_tarball_max_compression(self):
+ """Test that passing max compression works (#820846)"""
+ self._test_buildpackage('hello-debhelper',
+ 'dsc-3.0',
+ '2.8-1',
+ ['--git-no-pristine-tar', '--git-compression-level=9'])
+ out = subprocess.check_output(["file", "../hello-debhelper_2.8.orig.tar.gz"])
+ ok_("max compression" in out)