Rev 3227: Add missing test script. in http://people.ubuntu.com/~robertc/baz2.0/shallow-branch
Robert Collins
robertc at robertcollins.net
Thu Feb 14 02:08:08 GMT 2008
At http://people.ubuntu.com/~robertc/baz2.0/shallow-branch
------------------------------------------------------------
revno: 3227
revision-id:robertc at robertcollins.net-20080214020803-7d2spy97gxqd8yd9
parent: robertc at robertcollins.net-20080214004032-9vms1rfzv6tabsih
committer: Robert Collins <robertc at robertcollins.net>
branch nick: StackableBranch
timestamp: Thu 2008-02-14 13:08:03 +1100
message:
Add missing test script.
added:
bzrlib/tests/branch_implementations/test_stacking.py test_stacking.py-20080214020755-msjlkb7urobwly0f-1
=== added file 'bzrlib/tests/branch_implementations/test_stacking.py'
--- a/bzrlib/tests/branch_implementations/test_stacking.py 1970-01-01 00:00:00 +0000
+++ b/bzrlib/tests/branch_implementations/test_stacking.py 2008-02-14 02:08:03 +0000
@@ -0,0 +1,46 @@
+# Copyright (C) 2008 Canonical Ltd
+#
+# 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+"""Tests for Branch.get_stacked_on and set_stacked_on."""
+
+from bzrlib import errors
+from bzrlib.tests import TestNotApplicable
+from bzrlib.tests.branch_implementations import TestCaseWithBranch
+
+
+class TestStacking(TestCaseWithBranch):
+
+ def test_get_set_stacked_on(self):
+ # branches must either:
+ # raise UnstackableBranchFormat or
+ # raise UnstackableRepositoryFormat or
+ # permit stacking to be done and then return the stacked location.
+ branch = self.make_branch('branch')
+ target = self.make_branch('target')
+ old_format_errors = (
+ errors.UnstackableBranchFormat,
+ errors.UnstackableRepositoryFormat,
+ )
+ try:
+ branch.set_stacked_on(target.base)
+ except old_format_errors:
+ # if the set failed, so must the get
+ self.assertRaises(old_format_errors, branch.get_stacked_on)
+ return
+ # now we have a stacked branch:
+ self.assertEqual(target.base, branch.get_stacked_on)
+ branch.set_stacked_on(None)
+ self.assertRaises(NotStacked, branch.get_stacked_on)
More information about the bazaar-commits
mailing list