~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_fetch.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-03-06 06:48:25 UTC
  • mfrom: (4070.8.6 debug-config)
  • Revision ID: pqm@pqm.ubuntu.com-20090306064825-kbpwggw21dygeix6
(mbp) debug_flags configuration option

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
import os
18
18
import re
330
330
 
331
331
class TestKnitToPackFetch(TestCaseWithTransport):
332
332
 
333
 
    def find_get_record_stream(self, calls, expected_count=1):
334
 
        """In a list of calls, find the last 'get_record_stream'.
 
333
    def find_get_record_stream(self, calls):
 
334
        """In a list of calls, find 'get_record_stream' calls.
335
335
 
336
 
        :param expected_count: The number of calls we should exepect to find.
337
 
            If a different number is found, an assertion is raised.
 
336
        This also ensures that there is only one get_record_stream call.
338
337
        """
339
338
        get_record_call = None
340
 
        call_count = 0
341
339
        for call in calls:
342
340
            if call[0] == 'get_record_stream':
343
 
                call_count += 1
 
341
                self.assertIs(None, get_record_call,
 
342
                              "there should only be one call to"
 
343
                              " get_record_stream")
344
344
                get_record_call = call
345
 
        self.assertEqual(expected_count, call_count)
 
345
        self.assertIsNot(None, get_record_call,
 
346
                         "there should be exactly one call to "
 
347
                         " get_record_stream")
346
348
        return get_record_call
347
349
 
348
350
    def test_fetch_with_deltas_no_delta_closure(self):
368
370
                          target._format._fetch_order, False),
369
371
                         self.find_get_record_stream(source.texts.calls))
370
372
        self.assertEqual(('get_record_stream', [('rev-one',)],
371
 
          target._format._fetch_order, False),
372
 
          self.find_get_record_stream(source.inventories.calls, 2))
 
373
                          target._format._fetch_order, False),
 
374
                         self.find_get_record_stream(source.inventories.calls))
373
375
        self.assertEqual(('get_record_stream', [('rev-one',)],
374
376
                          target._format._fetch_order, False),
375
377
                         self.find_get_record_stream(source.revisions.calls))
412
414
                          target._format._fetch_order, True),
413
415
                         self.find_get_record_stream(source.texts.calls))
414
416
        self.assertEqual(('get_record_stream', [('rev-one',)],
415
 
            target._format._fetch_order, True),
416
 
            self.find_get_record_stream(source.inventories.calls, 2))
 
417
                          target._format._fetch_order, True),
 
418
                         self.find_get_record_stream(source.inventories.calls))
417
419
        self.assertEqual(('get_record_stream', [('rev-one',)],
418
420
                          target._format._fetch_order, True),
419
421
                         self.find_get_record_stream(source.revisions.calls))