diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2012-08-07 18:35:17 +0300 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2013-09-10 09:20:57 +0200 |
commit | c222197b5dd767578c8777d97316761890083c54 (patch) | |
tree | 6bfd466acf98045ce601d3e901dec34bc75bdbec | |
parent | b4e5b737ee7bfb4ef2bf6835e3abd9b792059513 (diff) | |
download | git-buildpackage-c222197b5dd767578c8777d97316761890083c54.tar.gz git-buildpackage-c222197b5dd767578c8777d97316761890083c54.tar.bz2 git-buildpackage-c222197b5dd767578c8777d97316761890083c54.zip |
tests: add test for archiving without git submodules
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rw-r--r-- | tests/04_test_submodules.py | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/tests/04_test_submodules.py b/tests/04_test_submodules.py index d96d67ab..c326f553 100644 --- a/tests/04_test_submodules.py +++ b/tests/04_test_submodules.py @@ -8,6 +8,7 @@ import os import shutil import tarfile import tempfile +from nose.tools import eq_, ok_ import gbp.log import gbp.git @@ -98,23 +99,29 @@ def test_dump_tree(): assert os.path.exists(os.path.join(dumpdir, submodules[0].name, testfile_name)) -def test_create_tarball(): +def test_create_tarballs(): """Create an upstream tarball""" - cp = { "Source": "test", "Upstream-Version": "0.1" } - assert buildpackage.git_archive(repo, - cp, - str(tmpdir), - "HEAD", - "bzip2", - "9", - True) - -def test_check_tarfile(): + # Tarball with submodules + changelog = { "Source": "test", "Upstream-Version": "0.1" } + ok_(buildpackage.git_archive(repo, changelog, str(tmpdir), "HEAD", "bzip2", + "9", True)) + # Tarball without submodules + changelog = { "Source": "test", "Upstream-Version": "0.2" } + ok_(buildpackage.git_archive(repo, changelog, str(tmpdir), "HEAD", "bzip2", + "9", False)) + +def test_check_tarfiles(): """Check the contents of the created tarfile""" - t = tarfile.open(tmpdir.join("test_0.1.orig.tar.bz2"), 'r:*') - files = t.getmembers() - assert "test-0.1/.gitmodules" in [ f.name for f in files ] - assert len(files) == 6 + # Check tarball with submodules + tarobj = tarfile.open(tmpdir.join("test_0.1.orig.tar.bz2"), 'r:*') + files = tarobj.getmembers() + ok_("test-0.1/.gitmodules" in [ f.name for f in files ]) + eq_(len(files) , 6) + # Check tarball without submodules + tarobj = tarfile.open(tmpdir.join("test_0.2.orig.tar.bz2"), 'r:*') + files = tarobj.getmembers() + ok_(("test-0.2/%s" % testfile_name) in [ f.name for f in files ]) + eq_(len(files) , 4) def test_add_whitespace_submodule(): """Add a second submodule with name containing whitespace""" |