~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to tests/test_link_tree.py

  • Committer: Alexander Belchenko
  • Date: 2008-04-28 15:35:42 UTC
  • mto: This revision was merged to the branch mainline in revision 635.
  • Revision ID: bialix@ukr.net-20080428153542-x9noc2v7uxr5w1b0
properly using HardlinkFeature in tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
import os
18
18
 
19
19
from bzrlib.transform import TreeTransform
20
 
from bzrlib.tests import TestCaseWithTransport
 
20
from bzrlib.tests import TestCaseWithTransport, HardlinkFeature
21
21
 
22
22
from bzrlib.plugins.bzrtools.link_tree import link_tree
23
23
 
45
45
 
46
46
    def test_link_fails_if_modified(self):
47
47
        """If the file to be linked has modified text, don't link."""
 
48
        self.requireFeature(HardlinkFeature)
48
49
        self.build_tree_contents([('child/foo', 'baz')])
49
50
        link_tree(self.child_tree, self.parent_tree)
50
51
        self.assertFalse(self.hardlinked())
51
52
 
52
53
    def test_link_fails_if_execute_bit_changed(self):
53
54
        """If the file to be linked has modified execute bit, don't link."""
 
55
        self.requireFeature(HardlinkFeature)
54
56
        tt = TreeTransform(self.child_tree)
55
57
        try:
56
58
            trans_id = tt.trans_id_tree_file_id('foo-id')
63
65
 
64
66
    def test_link_succeeds_if_unmodified(self):
65
67
        """If the file to be linked is unmodified, link"""
 
68
        self.requireFeature(HardlinkFeature)
66
69
        link_tree(self.child_tree, self.parent_tree)
67
70
        self.assertTrue(self.hardlinked())
68
71
 
71
74
 
72
75
    def test_link_tree(self):
73
76
        """Ensure the command works as intended"""
 
77
        self.requireFeature(HardlinkFeature)
74
78
        os.chdir('child')
75
79
        self.parent_tree.unlock()
76
80
        self.run_bzr('link-tree ../parent')