/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_chk_map.py

  • Committer: Vincent Ladeuil
  • Date: 2010-01-25 15:55:48 UTC
  • mto: (4985.1.4 add-attr-cleanup)
  • mto: This revision was merged to the branch mainline in revision 4988.
  • Revision ID: v.ladeuil+lp@free.fr-20100125155548-0l352pujvt5bzl5e
Deploy addAttrCleanup on the whole test suite.

Several use case worth mentioning:

- setting a module or any other object attribute is the majority
by far. In some cases the setting itself is deferred but most of
the time we want to set at the same time we add the cleanup.

- there multiple occurrences of protecting hooks or ui factory
which are now useless (the test framework takes care of that now),

- there was some lambda uses that can now be avoided.

That first cleanup already simplifies things a lot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2008, 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
905
905
        # Unmapping the new node will check the existing nodes to see if they
906
906
        # would fit.
907
907
        # Clear the page cache so we ensure we have to read all the children
908
 
        chk_map.clear_cache()
 
908
        chk_map._page_cache.clear()
909
909
        chkmap.unmap(('aad',))
910
910
        self.assertIsInstance(chkmap._root_node._items['aaa'], LeafNode)
911
911
        self.assertIsInstance(chkmap._root_node._items['aab'], LeafNode)
945
945
        # Now clear the page cache, and only include 2 of the children in the
946
946
        # cache
947
947
        aab_key = chkmap._root_node._items['aab']
948
 
        aab_bytes = chk_map._get_cache()[aab_key]
 
948
        aab_bytes = chk_map._page_cache[aab_key]
949
949
        aac_key = chkmap._root_node._items['aac']
950
 
        aac_bytes = chk_map._get_cache()[aac_key]
951
 
        chk_map.clear_cache()
952
 
        chk_map._get_cache()[aab_key] = aab_bytes
953
 
        chk_map._get_cache()[aac_key] = aac_bytes
 
950
        aac_bytes = chk_map._page_cache[aac_key]
 
951
        chk_map._page_cache.clear()
 
952
        chk_map._page_cache[aab_key] = aab_bytes
 
953
        chk_map._page_cache[aac_key] = aac_bytes
954
954
 
955
955
        # Unmapping the new node will check the nodes from the page cache
956
956
        # first, and not have to read in 'aaa'