Rev 419: Add a test at the 'view' level, that we don't access too much history. in http://bazaar.launchpad.net/~jameinel/loggerhead/page_loading

John Arbash Meinel john at arbash-meinel.com
Mon Mar 14 15:01:57 UTC 2011


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

------------------------------------------------------------
revno: 419
revision-id: john at arbash-meinel.com-20110314150147-70edfc2pkb557d2b
parent: john at arbash-meinel.com-20110314144914-j67mzkwdyrszv4yx
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: page_loading
timestamp: Mon 2011-03-14 16:01:47 +0100
message:
  Add a test at the 'view' level, that we don't access too much history.
-------------- next part --------------
=== modified file 'loggerhead/tests/test_history.py'
--- a/loggerhead/tests/test_history.py	2011-03-14 14:49:14 +0000
+++ b/loggerhead/tests/test_history.py	2011-03-14 15:01:47 +0000
@@ -99,14 +99,6 @@
         return history.History(b, {})
 
 
-class TestHistory(TestCaseWithExamples):
-
-    def test_get_file_view_iterable(self):
-        # We want to make sure that get_file_view returns an iterator, rather
-        # than pre-loading all history.
-        pass
-
-
 class _DictProxy(object):
 
     def __init__(self, d):
@@ -221,3 +213,20 @@
     def test_iter_with_extra_None(self):
         lst = list('abcdefghijklmnopqrstuvwxyz')
         self.assertIterate(lst, iter(lst), 'z', None)
+
+
+
+class TestHistoryGetView(TestCaseWithExamples):
+
+    def test_get_view_limited_history(self):
+        # get_view should only load enough history to serve the result, not all
+        # history.
+        his = self.make_long_linear_ancestry()
+        accessed = track_rev_info_accesses(his)
+        revid, start_revid, revid_list = his.get_view('Z', 'Z', None,
+                                                      extra_rev_count=5)
+        self.assertEqual(['Z', 'Y', 'X', 'W', 'V', 'U'], revid_list)
+        self.assertEqual('Z', revid)
+        self.assertEqual('Z', start_revid)
+        self.assertEqual(set([his._rev_indices[x] for x in 'ZYXWVU']),
+                         accessed)



More information about the bazaar-commits mailing list