~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_knit.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-10-04 07:12:14 UTC
  • mfrom: (2745.5.6 transport-get-file)
  • Revision ID: pqm@pqm.ubuntu.com-20071004071214-i0icltanhq59qtwt
(robertc) Transport improvements from packs: new trace+ transport, and readv adjust_for_latency feature, as well as test harness cleanup. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
    TestCaseWithMemoryTransport,
58
58
    TestCaseWithTransport,
59
59
    )
60
 
from bzrlib.transport import TransportLogger, get_transport
 
60
from bzrlib.transport import get_transport
61
61
from bzrlib.transport.memory import MemoryTransport
62
62
from bzrlib.util import bencode
63
63
from bzrlib.weave import Weave
1390
1390
        k1.get_texts(('%d' % t) for t in range(3))
1391
1391
        
1392
1392
    def test_iter_lines_reads_in_order(self):
1393
 
        t = MemoryTransport()
1394
 
        instrumented_t = TransportLogger(t)
 
1393
        instrumented_t = get_transport('trace+memory:///')
1395
1394
        k1 = KnitVersionedFile('id', instrumented_t, create=True, delta=True)
1396
 
        self.assertEqual([('id.kndx',)], instrumented_t._calls)
 
1395
        self.assertEqual([('get', 'id.kndx',)], instrumented_t._activity)
1397
1396
        # add texts with no required ordering
1398
1397
        k1.add_lines('base', [], ['text\n'])
1399
1398
        k1.add_lines('base2', [], ['text2\n'])
1400
1399
        k1.clear_cache()
1401
 
        instrumented_t._calls = []
 
1400
        # clear the logged activity, but preserve the list instance in case of
 
1401
        # clones pointing at it.
 
1402
        del instrumented_t._activity[:]
1402
1403
        # request a last-first iteration
1403
 
        results = list(k1.iter_lines_added_or_present_in_versions(['base2', 'base']))
1404
 
        self.assertEqual([('id.knit', [(0, 87), (87, 89)])], instrumented_t._calls)
 
1404
        results = list(k1.iter_lines_added_or_present_in_versions(
 
1405
            ['base2', 'base']))
 
1406
        self.assertEqual(
 
1407
            [('readv', 'id.knit', [(0, 87), (87, 89)], False, None)],
 
1408
            instrumented_t._activity)
1405
1409
        self.assertEqual(['text\n', 'text2\n'], results)
1406
1410
 
1407
1411
    def test_create_empty_annotated(self):