Rev 426: cherrypick the annotation test fix for bug #686324. in http://bazaar.launchpad.net/~jameinel/loggerhead/merge_pqm_updates

John Arbash Meinel john at arbash-meinel.com
Wed Feb 9 22:35:19 UTC 2011


At http://bazaar.launchpad.net/~jameinel/loggerhead/merge_pqm_updates

------------------------------------------------------------
revno: 426
revision-id: john at arbash-meinel.com-20110209223516-om3rux5jyjsi620q
parent: john at arbash-meinel.com-20110209223359-ciinnibu2o1vst39
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: merge_pqm_updates
timestamp: Wed 2011-02-09 16:35:16 -0600
message:
  cherrypick the annotation test fix for bug #686324.
  
  The pqm branch seems to have a failing test, so I don't know how the
  code ever landed there, but fix it anyway.
-------------- next part --------------
=== modified file 'loggerhead/tests/test_controllers.py'
--- a/loggerhead/tests/test_controllers.py	2009-03-19 18:48:15 +0000
+++ b/loggerhead/tests/test_controllers.py	2011-02-09 22:35:16 +0000
@@ -61,20 +61,25 @@
 
     def make_annotate_ui_for_file_history(self, file_id, rev_ids_texts):
         tree = self.make_branch_and_tree('.')
-        open('filename', 'w').write('')
+        self.build_tree_contents([('filename', '')])
         tree.add(['filename'], [file_id])
         for rev_id, text in rev_ids_texts:
-            open('filename', 'w').write(text)
+            self.build_tree_contents([('filename', text)])
             tree.commit(rev_id=rev_id, message='.')
         tree.branch.lock_read()
         self.addCleanup(tree.branch.unlock)
-        branch_app = BranchWSGIApp(tree.branch)
+        branch_app = BranchWSGIApp(tree.branch, friendly_name='test_name')
         return AnnotateUI(branch_app, branch_app.get_history)
 
     def test_annotate_file(self):
         history = [('rev1', 'old\nold\n'), ('rev2', 'new\nold\n')]
         ann_ui = self.make_annotate_ui_for_file_history('file_id', history)
-        annotated = list(ann_ui.annotate_file('file_id', 'rev2'))
+        # A lot of this state is set up by __call__, but we'll do it directly
+        # here.
+        ann_ui.args = ['rev2']
+        annotate_info = ann_ui.get_values('filename',
+            kwargs={'file_id': 'file_id'}, headers={})
+        annotated = list(annotate_info['annotated'])
         self.assertEqual(2, len(annotated))
         self.assertEqual('2', annotated[0].change.revno)
         self.assertEqual('1', annotated[1].change.revno)



More information about the bazaar-commits mailing list