Rev 4101: Change fetch effort tests to reflect the new change to read the adjacent inventories to ensure accurate fetching. in http://people.ubuntu.com/~robertc/baz2.0/fetch

Robert Collins robertc at robertcollins.net
Wed Mar 11 06:44:10 GMT 2009


At http://people.ubuntu.com/~robertc/baz2.0/fetch

------------------------------------------------------------
revno: 4101
revision-id: robertc at robertcollins.net-20090311064400-amcoxhotnw63d9vl
parent: robertc at robertcollins.net-20090311052614-v57k6mz9hqcxzgf6
committer: Robert Collins <robertc at robertcollins.net>
branch nick: fetch
timestamp: Wed 2009-03-11 17:44:00 +1100
message:
  Change fetch effort tests to reflect the new change to read the adjacent inventories to ensure accurate fetching.
=== modified file 'bzrlib/tests/test_fetch.py'
--- a/bzrlib/tests/test_fetch.py	2009-03-02 04:45:02 +0000
+++ b/bzrlib/tests/test_fetch.py	2009-03-11 06:44:00 +0000
@@ -330,21 +330,19 @@
 
 class TestKnitToPackFetch(TestCaseWithTransport):
 
-    def find_get_record_stream(self, calls):
-        """In a list of calls, find 'get_record_stream' calls.
+    def find_get_record_stream(self, calls, expected_count=1):
+        """In a list of calls, find the last 'get_record_stream'.
 
-        This also ensures that there is only one get_record_stream call.
+        :param expected_count: The number of calls we should exepect to find.
+            If a different number is found, an assertion is raised.
         """
         get_record_call = None
+        call_count = 0
         for call in calls:
             if call[0] == 'get_record_stream':
-                self.assertIs(None, get_record_call,
-                              "there should only be one call to"
-                              " get_record_stream")
+                call_count += 1
                 get_record_call = call
-        self.assertIsNot(None, get_record_call,
-                         "there should be exactly one call to "
-                         " get_record_stream")
+        self.assertEqual(expected_count, call_count)
         return get_record_call
 
     def test_fetch_with_deltas_no_delta_closure(self):
@@ -370,8 +368,8 @@
                           target._format._fetch_order, False),
                          self.find_get_record_stream(source.texts.calls))
         self.assertEqual(('get_record_stream', [('rev-one',)],
-                          target._format._fetch_order, False),
-                         self.find_get_record_stream(source.inventories.calls))
+          target._format._fetch_order, False),
+          self.find_get_record_stream(source.inventories.calls, 2))
         self.assertEqual(('get_record_stream', [('rev-one',)],
                           target._format._fetch_order, False),
                          self.find_get_record_stream(source.revisions.calls))
@@ -414,8 +412,8 @@
                           target._format._fetch_order, True),
                          self.find_get_record_stream(source.texts.calls))
         self.assertEqual(('get_record_stream', [('rev-one',)],
-                          target._format._fetch_order, True),
-                         self.find_get_record_stream(source.inventories.calls))
+            target._format._fetch_order, True),
+            self.find_get_record_stream(source.inventories.calls, 2))
         self.assertEqual(('get_record_stream', [('rev-one',)],
                           target._format._fetch_order, True),
                          self.find_get_record_stream(source.revisions.calls))




More information about the bazaar-commits mailing list