~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_graph.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-03-24 23:19:12 UTC
  • mfrom: (4190.1.6 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090324231912-rb0kgktzkvge8aea
(robertc) Negatively cache ghosts and misses during read-locks in
        RemoteRepository. (Robert Collins, Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1385
1385
 
1386
1386
 
1387
1387
class TestCachingParentsProvider(tests.TestCase):
 
1388
    """These tests run with:
 
1389
 
 
1390
    self.inst_pp, a recording parents provider with a graph of a->b, and b is a
 
1391
    ghost.
 
1392
    self.caching_pp, a CachingParentsProvider layered on inst_pp.
 
1393
    """
1388
1394
 
1389
1395
    def setUp(self):
1390
1396
        super(TestCachingParentsProvider, self).setUp()
1409
1415
        self.assertEqual({}, self.caching_pp.get_parent_map(['b']))
1410
1416
        # No new calls
1411
1417
        self.assertEqual(['b'], self.inst_pp.calls)
1412
 
        self.assertEqual({'b':None}, self.caching_pp._cache)
1413
1418
 
1414
1419
    def test_get_parent_map_mixed(self):
1415
1420
        """Anything that can be returned from cache, should be"""
1427
1432
        # only present 1 time.
1428
1433
        self.assertEqual(['a', 'b'], sorted(self.inst_pp.calls))
1429
1434
 
 
1435
    def test_note_missing_key(self):
 
1436
        """After noting that a key is missing it is cached."""
 
1437
        self.caching_pp.note_missing_key('b')
 
1438
        self.assertEqual({}, self.caching_pp.get_parent_map(['b']))
 
1439
        self.assertEqual([], self.inst_pp.calls)
 
1440
        self.assertEqual(set(['b']), self.caching_pp.missing_keys)
 
1441
 
1430
1442
 
1431
1443
class TestCachingParentsProviderExtras(tests.TestCaseWithTransport):
1432
1444
    """Test the behaviour when parents are provided that were not requested."""