Rev 3684: Update branch open tests to accomodate stacking. in http://people.ubuntu.com/~robertc/baz2.0/integration
Robert Collins
robertc at robertcollins.net
Tue Sep 23 04:21:11 BST 2008
At http://people.ubuntu.com/~robertc/baz2.0/integration
------------------------------------------------------------
revno: 3684
revision-id: robertc at robertcollins.net-20080923032107-ibt7hdhdwcanbvvp
parent: robertc at robertcollins.net-20080923021655-w6fiwcz42r9ju9xs
committer: Robert Collins <robertc at robertcollins.net>
branch nick: integration
timestamp: Tue 2008-09-23 13:21:07 +1000
message:
Update branch open tests to accomodate stacking.
modified:
bzrlib/tests/branch_implementations/test_hooks.py test_hooks.py-20070129154855-blhpwxmvjs07waei-1
=== modified file 'bzrlib/tests/branch_implementations/test_hooks.py'
--- a/bzrlib/tests/branch_implementations/test_hooks.py 2008-09-04 05:23:39 +0000
+++ b/bzrlib/tests/branch_implementations/test_hooks.py 2008-09-23 03:21:07 +0000
@@ -16,8 +16,9 @@
"""Tests that branch classes implement hook callouts correctly."""
+from bzrlib.branch import Branch, ChangeBranchTipParams
from bzrlib.errors import HookFailed, TipChangeRejected
-from bzrlib.branch import Branch, ChangeBranchTipParams
+from bzrlib.remote import RemoteBranch
from bzrlib.revision import NULL_REVISION
from bzrlib.tests import TestCaseWithMemoryTransport
@@ -125,7 +126,18 @@
branch_url = self.make_branch('.').bzrdir.root_transport.base
self.install_hook()
b = Branch.open(branch_url)
- self.assertEqual([b], self.hook_calls)
+ if isinstance(b, RemoteBranch):
+ # RemoteBranch open always opens the backing branch to get stacking
+ # details. As that is done remotely we can't see the branch object
+ # nor even compare base url's etc. So we just assert that the first
+ # branch returned is the RemoteBranch, and that the second is a
+ # Branch but not a RemoteBranch.
+ self.assertEqual(2, len(self.hook_calls))
+ self.assertEqual(b, self.hook_calls[0])
+ self.assertIsInstance(self.hook_calls[1], Branch)
+ self.assertFalse(isinstance(self.hook_calls[1], RemoteBranch))
+ else:
+ self.assertEqual([b], self.hook_calls)
class TestPreChangeBranchTip(ChangeBranchTipTestCase):
More information about the bazaar-commits
mailing list