1773.4.1
by Martin Pool
Add pyflakes makefile target; fix many warnings |
1 |
# Copyright (C) 2006 Canonical Ltd
|
1534.5.5
by Robert Collins
Move is_control_file into WorkingTree.is_control_filename and test. |
2 |
# Authors: Robert Collins <robert.collins@canonical.com>
|
3 |
#
|
|
4 |
# This program is free software; you can redistribute it and/or modify
|
|
5 |
# it under the terms of the GNU General Public License as published by
|
|
6 |
# the Free Software Foundation; either version 2 of the License, or
|
|
7 |
# (at your option) any later version.
|
|
8 |
#
|
|
9 |
# This program is distributed in the hope that it will be useful,
|
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
# GNU General Public License for more details.
|
|
13 |
#
|
|
14 |
# You should have received a copy of the GNU General Public License
|
|
15 |
# along with this program; if not, write to the Free Software
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
1534.5.5
by Robert Collins
Move is_control_file into WorkingTree.is_control_filename and test. |
17 |
|
18 |
from bzrlib.osutils import basename |
|
4523.1.4
by Martin Pool
Rename remaining *_implementations tests |
19 |
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree |
1534.5.5
by Robert Collins
Move is_control_file into WorkingTree.is_control_filename and test. |
20 |
|
21 |
||
22 |
class TestIsControlFilename(TestCaseWithWorkingTree): |
|
23 |
||
24 |
def validate_tree_is_controlfilename(self, tree): |
|
25 |
"""check that 'tree' obeys the contract for is_control_filename."""
|
|
26 |
bzrdirname = basename(tree.bzrdir.transport.base[:-1]) |
|
27 |
self.assertTrue(tree.is_control_filename(bzrdirname)) |
|
28 |
self.assertTrue(tree.is_control_filename(bzrdirname + '/subdir')) |
|
29 |
self.assertFalse(tree.is_control_filename('dir/' + bzrdirname)) |
|
30 |
self.assertFalse(tree.is_control_filename('dir/' + bzrdirname + '/sub')) |
|
31 |
||
32 |
def test_dotbzr_is_control_in_cwd(self): |
|
33 |
tree = self.make_branch_and_tree('.') |
|
34 |
self.validate_tree_is_controlfilename(tree) |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
35 |
|
1534.5.5
by Robert Collins
Move is_control_file into WorkingTree.is_control_filename and test. |
36 |
def test_dotbzr_is_control_in_subdir(self): |
37 |
tree = self.make_branch_and_tree('subdir') |
|
38 |
self.validate_tree_is_controlfilename(tree) |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
39 |