aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2017-10-20 11:29:14 +0200
committerGuido Günther <agx@sigxcpu.org>2017-10-20 11:29:14 +0200
commit15510515a5fa98d212082057effb6b002310125e (patch)
tree3d7c867fedcdccff8ea01fdfe3edbf468bc5f9a2 /tests
parent17dbb90b105a098febd2a70dff07cf3e85ffa5cc (diff)
pq: import pq branch on switch
Closes: #761166
Diffstat (limited to 'tests')
-rw-r--r--tests/13_test_gbp_pq.py14
-rw-r--r--tests/component/deb/test_pq.py9
2 files changed, 17 insertions, 6 deletions
diff --git a/tests/13_test_gbp_pq.py b/tests/13_test_gbp_pq.py
index 6136454c..2e9f8a60 100644
--- a/tests/13_test_gbp_pq.py
+++ b/tests/13_test_gbp_pq.py
@@ -23,7 +23,9 @@ import unittest
from gbp.command_wrappers import GitCommand
from gbp.scripts.pq import (generate_patches, export_patches,
- import_quilt_patches, rebase_pq, SERIES_FILE)
+ import_quilt_patches, rebase_pq,
+ switch_pq,
+ SERIES_FILE)
import gbp.scripts.common.pq as pq
import gbp.patch_series
@@ -239,7 +241,7 @@ class TestExport(testutils.DebianGitTestRepo):
opts.drop = True
repo.create_branch(pq.pq_branch_name('master'))
- pq.switch_pq(repo, start)
+ switch_pq(repo, start, opts)
self.assertEqual(repo.get_branch(), pq_branch)
export_patches(repo, pq_branch, opts)
self.assertEqual(repo.get_branch(), start)
@@ -253,7 +255,7 @@ class TestExport(testutils.DebianGitTestRepo):
opts = TestExport.Options()
opts.commit = True
repo.create_branch(pq.pq_branch_name('master'))
- pq.switch_pq(repo, start)
+ switch_pq(repo, start, opts)
self.assertEqual(len(repo.get_commits()), 1)
self.assertEqual(repo.get_branch(), pq_branch)
self.add_file('foo', 'foo')
@@ -282,7 +284,7 @@ class TestExport(testutils.DebianGitTestRepo):
repo.add_files('debian/patches')
repo.commit_all('Add series file')
repo.create_branch(pq.pq_branch_name('master'))
- pq.switch_pq(repo, start)
+ switch_pq(repo, start, opts)
self.assertEqual(len(repo.get_commits()), 2)
self.assertEqual(repo.get_branch(), pq_branch)
export_patches(repo, pq_branch, opts)
@@ -394,7 +396,7 @@ class TestFromTAG(testutils.DebianGitTestRepo):
self.assertTrue(os.path.exists(os.path.join(self.repo.path,
os.path.dirname(SERIES_FILE),
'added-bar.patch')))
- pq.switch_pq(self.repo, 'master')
+ switch_pq(self.repo, 'master', TestFromTAG.Options)
rebase_pq(self.repo,
branch=self.repo.get_branch(),
options=TestFromTAG.Options())
@@ -418,7 +420,7 @@ class TestFromTAG(testutils.DebianGitTestRepo):
' -- Mr. T. S. <t@example.com> '
'Thu, 01 Jan 1970 00:00:00 +0000\n'
)
- pq.switch_pq(self.repo, 'master')
+ switch_pq(self.repo, 'master', TestFromTAG.Options())
rebase_pq(self.repo,
branch=self.repo.get_branch(),
options=TestFromTAG.Options())
diff --git a/tests/component/deb/test_pq.py b/tests/component/deb/test_pq.py
index 2f0f247e..5a2395b4 100644
--- a/tests/component/deb/test_pq.py
+++ b/tests/component/deb/test_pq.py
@@ -38,11 +38,20 @@ class TestPq(ComponentTestBase):
@RepoFixtures.quilt30()
def test_rebase_import(self, repo):
"""Test if rebase imports patches first"""
+ eq_(repo.branch, 'master')
eq_(repo.has_branch('patch-queue/master'), False)
self._test_pq(repo, 'rebase')
eq_(repo.has_branch('patch-queue/master'), True)
@RepoFixtures.quilt30()
+ def test_switch_import(self, repo):
+ """Test if switch imports patches first"""
+ eq_(repo.branch, 'master')
+ eq_(repo.has_branch('patch-queue/master'), False)
+ self._test_pq(repo, 'switch')
+ eq_(repo.has_branch('patch-queue/master'), True)
+
+ @RepoFixtures.quilt30()
def test_empty_cycle(self, repo):
eq_(repo.has_branch('patch-queue/master'), False)
eq_(repo.branch, 'master')