Rev 125: Fixup tests. in http://bazaar.launchpad.net/~bzr-loom-devs/bzr-loom/trunk/

Robert Collins robertc at robertcollins.net
Sat Jul 3 13:00:11 BST 2010


At http://bazaar.launchpad.net/~bzr-loom-devs/bzr-loom/trunk/

------------------------------------------------------------
revno: 125
revision-id: robertc at robertcollins.net-20100703120010-t4zlko3ref9t8bqu
parent: robertc at robertcollins.net-20100702061532-fipau3lbxb4966bb
committer: Robert Collins <robertc at robertcollins.net>
branch nick: trunk
timestamp: Sat 2010-07-03 22:00:10 +1000
message:
  Fixup tests.
=== modified file 'branch.py'
--- a/branch.py	2010-07-02 05:24:30 +0000
+++ b/branch.py	2010-07-03 12:00:10 +0000
@@ -396,6 +396,10 @@
         """Rename the current thread to nick."""
         state = self.get_loom_state()
         threads = state.get_threads()
+        if not len(threads):
+            # No threads at all - probably a default initialised loom in the
+            # test suite.
+            return self._set_nick(nick)
         current_index = state.thread_index(self.nick)
         threads[current_index] = (nick,) + threads[current_index][1:]
         state.set_threads(threads)

=== modified file 'tests/test_branch.py'
--- a/tests/test_branch.py	2010-07-02 05:24:30 +0000
+++ b/tests/test_branch.py	2010-07-03 12:00:10 +0000
@@ -52,11 +52,18 @@
         self.assertFileEqual('Loom current 1\n\n', '.bzr/branch/last-loom')
 
 
+
+class StubFormat(object):
+
+    def network_name(self):
+        return "Nothing to see."
+
+
 class LockableStub(object):
 
     def __init__(self):
         self._calls = []
-        self._format = "Nothing to see."
+        self._format = StubFormat()
 
     def lock_write(self):
         self._calls.append(("write",))




More information about the bazaar-commits mailing list