~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Andrew Bennetts
  • Date: 2010-10-08 08:15:14 UTC
  • mto: This revision was merged to the branch mainline in revision 5498.
  • Revision ID: andrew.bennetts@canonical.com-20101008081514-dviqzrdfwyzsqbz2
Split NEWS into per-release doc/en/release-notes/bzr-*.txt

Show diffs side-by-side

added added

removed removed

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