~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Patch Queue Manager
  • Date: 2016-04-21 04:10:52 UTC
  • mfrom: (6616.1.1 fix-en-user-guide)
  • Revision ID: pqm@pqm.ubuntu.com-20160421041052-clcye7ns1qcl2n7w
(richard-wilbur) Ensure build of English use guide always uses English text
 even when user's locale specifies a different language. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2010 Canonical Ltd
 
1
# Copyright (C) 2010, 2011, 2016 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
20
20
import os
21
21
 
22
22
from bzrlib import (
23
 
    builtins,
24
23
    osutils,
25
24
    tests,
26
25
    workingtree,
27
26
    )
28
27
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
 
28
from bzrlib.tests import (
 
29
    features,
 
30
    )
29
31
 
30
32
 
31
33
class TestSmartAddTree(TestCaseWithWorkingTree):
32
34
 
33
35
    # See eg <https://bugs.launchpad.net/bzr/+bug/192859>
34
36
 
35
 
    _test_needs_features = [tests.SymlinkFeature]
 
37
    _test_needs_features = [features.SymlinkFeature]
36
38
 
37
39
    def test_smart_add_symlink(self):
38
40
        tree = self.make_branch_and_tree('tree')
65
67
            ('tree/dir/',),
66
68
            ('tree/dir/file', 'content'),
67
69
            ])
68
 
        self.assertEquals(
 
70
        self.assertEqual(
69
71
            tree.smart_add(['tree/link/file']),
70
72
            ([u'dir', u'dir/file'], {}))
71
73
        # should add the actual parent directory, not the apparent parent
78
80
 
79
81
class TestKindChanges(TestCaseWithWorkingTree):
80
82
 
81
 
    _test_needs_features = [tests.SymlinkFeature]
 
83
    _test_needs_features = [features.SymlinkFeature]
82
84
 
83
85
    def test_symlink_changes_to_dir(self):
84
86
        # <https://bugs.launchpad.net/bzr/+bug/192859>:
101
103
        tree.commit('change to dir')
102
104
        tree.lock_read()
103
105
        self.addCleanup(tree.unlock)
104
 
        self.assertEquals([], list(tree.iter_changes(tree.basis_tree())))
105
 
        self.assertEquals(
106
 
            ['a', 'a/f'], sorted(info[0] for info in tree.list_files()))
 
106
        self.assertEqual([], list(tree.iter_changes(tree.basis_tree())))
 
107
        if tree._format.supports_versioned_directories:
 
108
            self.assertEqual(
 
109
                ['a', 'a/f'], sorted(info[0] for info in tree.list_files()))
 
110
        else:
 
111
            self.assertEqual([], list(tree.list_files()))
107
112
 
108
113
    def test_dir_changes_to_symlink(self):
109
114
        # <https://bugs.launchpad.net/bzr/+bug/192859>:
128
133
 
129
134
class TestOpenTree(TestCaseWithWorkingTree):
130
135
 
131
 
    _test_needs_features = [tests.SymlinkFeature]
 
136
    _test_needs_features = [features.SymlinkFeature]
132
137
 
133
138
    def test_open_containing_through_symlink(self):
134
139
        self.make_test_tree()
143
148
    def check_open_containing(self, to_open, expected_tree_name,
144
149
        expected_relpath):
145
150
        wt, relpath = workingtree.WorkingTree.open_containing(to_open)
146
 
        self.assertEquals(relpath, expected_relpath)
 
151
        self.assertEqual(relpath, expected_relpath)
147
152
        self.assertEndsWith(wt.basedir, expected_tree_name)
148
153
 
149
154
    def test_tree_files(self):
161
166
    def check_tree_files(self, to_open, expected_tree, expect_paths):
162
167
        tree, relpaths = workingtree.WorkingTree.open_containing_paths(to_open)
163
168
        self.assertEndsWith(tree.basedir, expected_tree)
164
 
        self.assertEquals(expect_paths, relpaths)
 
169
        self.assertEqual(expect_paths, relpaths)
165
170
 
166
171
    def make_test_tree(self):
167
172
        tree = self.make_branch_and_tree('tree')