~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_workingtree/test_add_reference.py

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil
  • Date: 2017-01-30 14:42:05 UTC
  • mfrom: (6620.1.1 trunk)
  • Revision ID: tarmac-20170130144205-r8fh2xpmiuxyozpv
Merge  2.7 into trunk including fix for bug #1657238 [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2006-2009, 2011 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
16
16
 
17
17
import os
18
18
 
19
 
from bzrlib import errors, tests, workingtree, workingtree_4
 
19
from bzrlib import errors, tests, workingtree
20
20
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
21
21
 
22
 
TREES_NOT_SUPPORTING_REFERENCES = (workingtree.WorkingTree2,
23
 
                                   workingtree.WorkingTree3,
24
 
                                   workingtree_4.WorkingTree4)
25
 
 
26
22
 
27
23
class TestBasisInventory(TestCaseWithWorkingTree):
28
24
 
37
33
        return tree, sub_tree
38
34
 
39
35
    def _references_unsupported(self, tree):
40
 
        if tree.__class__ in TREES_NOT_SUPPORTING_REFERENCES:
41
 
            raise tests.TestSkipped('Tree format does not support references')
 
36
        if not tree.supports_tree_reference():
 
37
            raise tests.TestNotApplicable(
 
38
                'Tree format does not support references')
42
39
        else:
43
40
            self.fail('%r does not support references but should'
44
41
                % (tree, ))
57
54
        tree.lock_write()
58
55
        try:
59
56
            self.assertEqual(tree.path2id('sub-tree'), 'sub-tree-root-id')
60
 
            self.assertEqual(tree.inventory['sub-tree-root-id'].kind,
61
 
                             'tree-reference')
 
57
            self.assertEqual(tree.kind('sub-tree-root-id'), 'tree-reference')
62
58
            tree.commit('commit reference')
63
59
            basis = tree.basis_tree()
64
60
            basis.lock_read()