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
17
17
"""Tests for WorkingTree.read_working_inventory."""
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
25
23
class TestReadWorkingInventory(TestCaseWithWorkingTree):
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")
33
28
self.assertIsInstance(tree.read_working_inventory(), inventory.Inventory)
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
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
50
42
tree.read_working_inventory()
51
43
except errors.InventoryModified: