1 # vim: set fileencoding=utf-8 :
3 # (C) 2013,2014 Guido Günther <agx@sigxcpu.org>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 from tests.component import (ComponentTestBase,
22 ComponentTestGitRepository)
23 from tests.component.deb import DEB_TEST_DATA_DIR
25 from nose.tools import ok_
27 from gbp.scripts.import_dsc import main as import_dsc
29 class TestImportDsc(ComponentTestBase):
30 """Test importing of debian source packages"""
32 def test_debian_import(self):
33 """Test that importing of debian native packages works"""
35 return os.path.join(DEB_TEST_DATA_DIR,
37 'git-buildpackage_%s.dsc' % version)
40 assert import_dsc(['arg0', dsc]) == 0
41 repo = ComponentTestGitRepository('git-buildpackage')
42 self._check_repo_state(repo, 'master', ['master'])
43 assert len(repo.get_commits()) == 1
45 os.chdir('git-buildpackage')
47 assert import_dsc(['arg0', dsc]) == 0
48 self._check_repo_state(repo, 'master', ['master'])
49 assert len(repo.get_commits()) == 2
52 assert import_dsc(['arg0', dsc]) == 0
53 self._check_repo_state(repo, 'master', ['master'])
54 assert len(repo.get_commits()) == 3
56 # def test_create_branches(self):
57 # """Test if creating missing branches works"""
59 # return os.path.join(DEB_TEST_DATA_DIR,
61 # 'hello-debhelper_%s.dsc' % version)
64 # assert import_dsc(['arg0',
66 # '--debian-branch=master',
67 # '--upstream-branch=upstream',
69 # repo = ComponentTestGitRepository('hello-debhelper')
70 # os.chdir('hello-debhelper')
71 # assert len(repo.get_commits()) == 2
72 # self._check_repo_state(repo, 'master', ['master', 'pristine-tar', 'upstream'])
74 # assert import_dsc(['arg0',
76 # '--debian-branch=foo',
77 # '--upstream-branch=bar',
78 # '--create-missing-branches',
80 # self._check_repo_state(repo, 'master', ['bar', 'foo', 'master', 'pristine-tar', 'upstream'])
81 # commits, expected = len(repo.get_commits()), 2
82 # ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected))