~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/workingtree_implementations/test_read_working_inventory.py

  • Committer: John Arbash Meinel
  • Author(s): Mark Hammond
  • Date: 2008-09-09 17:02:21 UTC
  • mto: This revision was merged to the branch mainline in revision 3697.
  • Revision ID: john@arbash-meinel.com-20080909170221-svim3jw2mrz0amp3
An updated transparent icon for bzr.

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
"""Tests for WorkingTree.read_working_inventory."""
18
18
 
19
19
from bzrlib import errors, inventory
20
 
from bzrlib.tests import TestNotApplicable
21
 
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
22
 
from bzrlib.workingtree import InventoryWorkingTree
 
20
from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
23
21
 
24
22
 
25
23
class TestReadWorkingInventory(TestCaseWithWorkingTree):
26
24
 
27
25
    def test_trivial_read(self):
28
26
        tree = self.make_branch_and_tree('t1')
29
 
        if not isinstance(tree, InventoryWorkingTree):
30
 
            raise TestNotApplicable("read_working_inventory not usable on "
31
 
                "non-inventory working trees")
32
27
        tree.lock_read()
33
28
        self.assertIsInstance(tree.read_working_inventory(), inventory.Inventory)
34
29
        tree.unlock()
35
30
 
36
31
    def test_read_after_inventory_modification(self):
37
32
        tree = self.make_branch_and_tree('tree')
38
 
        if not isinstance(tree, InventoryWorkingTree):
39
 
            raise TestNotApplicable("read_working_inventory not usable on "
40
 
                "non-inventory working trees")
41
 
        # prepare for a series of changes that will modify the
 
33
        # prepare for a series of changes that will modify the 
42
34
        # inventory
43
35
        tree.lock_write()
44
36
        try:
45
37
            tree.set_root_id('new-root')
46
 
            # having dirtied the inventory, we can now expect an
 
38
            # having dirtied the inventory, we can now expect an 
47
39
            # InventoryModified exception when doing a read_working_inventory()
48
 
            # OR, the call can be ignored and the changes preserved
 
40
            # OR, the call can be ignored and hte changes preserved
49
41
            try:
50
42
                tree.read_working_inventory()
51
43
            except errors.InventoryModified: