Disbale test_create_branches unit case
[tools/git-buildpackage.git] / tests / component / deb / test_import_dsc.py
1 # vim: set fileencoding=utf-8 :
2 #
3 # (C) 2013,2014 Guido Günther <agx@sigxcpu.org>
4 #
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.
9 #
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.
14 #
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
18
19 import os
20
21 from tests.component import (ComponentTestBase,
22                              ComponentTestGitRepository)
23 from tests.component.deb import DEB_TEST_DATA_DIR
24
25 from nose.tools import ok_
26
27 from gbp.scripts.import_dsc import main as import_dsc
28
29 class TestImportDsc(ComponentTestBase):
30     """Test importing of debian source packages"""
31
32     def test_debian_import(self):
33         """Test that importing of debian native packages works"""
34         def _dsc(version):
35             return os.path.join(DEB_TEST_DATA_DIR,
36                                 'dsc-native',
37                                 'git-buildpackage_%s.dsc' % version)
38
39         dsc = _dsc('0.4.14')
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
44
45         os.chdir('git-buildpackage')
46         dsc = _dsc('0.4.15')
47         assert import_dsc(['arg0', dsc]) == 0
48         self._check_repo_state(repo, 'master', ['master'])
49         assert len(repo.get_commits()) == 2
50
51         dsc = _dsc('0.4.16')
52         assert import_dsc(['arg0', dsc]) == 0
53         self._check_repo_state(repo, 'master', ['master'])
54         assert len(repo.get_commits()) == 3
55
56 #    def test_create_branches(self):
57 #        """Test if creating missing branches works"""
58 #        def _dsc(version):
59 #            return os.path.join(DEB_TEST_DATA_DIR,
60 #                                'dsc-3.0',
61 #                                'hello-debhelper_%s.dsc' % version)
62 #
63 #        dsc = _dsc('2.6-2')
64 #        assert import_dsc(['arg0',
65 #                           '--pristine-tar',
66 #                           '--debian-branch=master',
67 #                           '--upstream-branch=upstream',
68 #                           dsc]) == 0
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'])
73 #        dsc = _dsc('2.8-1')
74 #        assert import_dsc(['arg0',
75 #                           '--pristine-tar',
76 #                           '--debian-branch=foo',
77 #                           '--upstream-branch=bar',
78 #                           '--create-missing-branches',
79 #                           dsc]) == 0
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))