/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
2255.7.9 by John Arbash Meinel
Add more tests for WorkingTree.move() and a similar suite
1
# Copyright (C) 2006, 2007 Canonical Ltd
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
2
#
1534.4.46 by Robert Collins
Nearly complete .bzr/checkout splitout.
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
7
#
1534.4.46 by Robert Collins
Nearly complete .bzr/checkout splitout.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
12
#
1534.4.46 by Robert Collins
Nearly complete .bzr/checkout splitout.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
4183.7.1 by Sabin Iacob
update FSF mailing address
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1534.4.46 by Robert Collins
Nearly complete .bzr/checkout splitout.
16
17
18
"""WorkingTree implementation tests for bzr.
19
20
These test the conformance of all the workingtre variations to the expected API.
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
21
Specific tests for individual formats are in the tests/test_workingtree file
4523.1.4 by Martin Pool
Rename remaining *_implementations tests
22
rather than in tests/per_workingtree/*.py.
1534.4.46 by Robert Collins
Nearly complete .bzr/checkout splitout.
23
"""
24
4285.2.1 by Vincent Ladeuil
Cleanup test imports and use features to better track skipped tests.
25
from bzrlib import (
26
    errors,
27
    tests,
28
    workingtree,
29
    )
4523.1.2 by Martin Pool
Rename bzrdir_implementations to per_bzrdir
30
from bzrlib.tests import per_bzrdir
1534.5.5 by Robert Collins
Move is_control_file into WorkingTree.is_control_filename and test.
31
32
4084.5.1 by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters.
33
def make_scenarios(transport_server, transport_readonly_server, formats):
34
    result = []
35
    for workingtree_format in formats:
36
        result.append((workingtree_format.__class__.__name__,
4285.2.1 by Vincent Ladeuil
Cleanup test imports and use features to better track skipped tests.
37
                       make_scenario(transport_server,
38
                                     transport_readonly_server,
39
                                     workingtree_format)))
4084.5.1 by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters.
40
    return result
41
42
43
def make_scenario(transport_server, transport_readonly_server,
4285.2.1 by Vincent Ladeuil
Cleanup test imports and use features to better track skipped tests.
44
                  workingtree_format):
4084.5.1 by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters.
45
    return {
46
        "transport_server": transport_server,
47
        "transport_readonly_server": transport_readonly_server,
48
        "bzrdir_format": workingtree_format._matchingbzrdir,
49
        "workingtree_format": workingtree_format,
50
        }
3363.1.1 by Aaron Bentley
Refactor intertree scenario creation
51
2553.2.10 by Robert Collins
And overhaul WorkingTreeTestProviderAdapter too.
52
4523.1.2 by Martin Pool
Rename bzrdir_implementations to per_bzrdir
53
class TestCaseWithWorkingTree(per_bzrdir.TestCaseWithBzrDir):
1666.1.4 by Robert Collins
* 'Metadir' is now the default disk format. This improves behaviour in
54
55
    def make_branch_and_tree(self, relpath, format=None):
56
        made_control = self.make_bzrdir(relpath, format=format)
1534.5.5 by Robert Collins
Move is_control_file into WorkingTree.is_control_filename and test.
57
        made_control.create_repository()
58
        made_control.create_branch()
59
        return self.workingtree_format.initialize(made_control)
1534.4.46 by Robert Collins
Nearly complete .bzr/checkout splitout.
60
61
4505.5.3 by Robert Collins
Test infrastructure for testing all inventory delta applications and fix CHK inventories to reject repeated file ids in deltas.
62
def workingtree_formats():
63
    """The known working tree formats."""
64
    return (workingtree.WorkingTreeFormat._formats.values() +
65
        workingtree._legacy_formats)
66
67
4084.5.1 by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters.
68
def load_tests(standard_tests, module, loader):
4332.3.2 by Robert Collins
Extract repository access in WorkingTree._check to be data driven, adding a new _get_check_refs method to support this.
69
    test_names = [
70
        'add_reference',
71
        'add',
4523.1.5 by Vincent Ladeuil
Fixed as asked in review.
72
        'annotate_iter',
4332.3.2 by Robert Collins
Extract repository access in WorkingTree._check to be data driven, adding a new _get_check_refs method to support this.
73
        'basis_inventory',
74
        'basis_tree',
75
        'break_lock',
76
        'changes_from',
77
        'check',
78
        'content_filters',
79
        'commit',
80
        'eol_conversion',
81
        'executable',
82
        'flush',
83
        'get_file_mtime',
84
        'get_parent_ids',
85
        'inv',
86
        'is_control_filename',
87
        'is_ignored',
88
        'locking',
89
        'merge_from_branch',
90
        'mkdir',
91
        'move',
92
        'nested_specifics',
93
        'parents',
94
        'paths2ids',
95
        'pull',
96
        'put_file',
97
        'readonly',
98
        'read_working_inventory',
99
        'remove',
100
        'rename_one',
101
        'revision_tree',
102
        'set_root_id',
103
        'smart_add',
104
        'uncommit',
105
        'unversion',
106
        'views',
107
        'walkdirs',
108
        'workingtree',
109
        ]
1534.4.46 by Robert Collins
Nearly complete .bzr/checkout splitout.
110
    test_workingtree_implementations = [
4332.3.32 by Robert Collins
Merge bzr.dev.
111
        'bzrlib.tests.per_workingtree.test_' + name for
4332.3.2 by Robert Collins
Extract repository access in WorkingTree._check to be data driven, adding a new _get_check_refs method to support this.
112
        name in test_names]
3302.9.16 by Vincent Ladeuil
bzrlib.tests.workingtree_implementations switched from
113
4084.5.1 by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters.
114
    scenarios = make_scenarios(
4285.2.1 by Vincent Ladeuil
Cleanup test imports and use features to better track skipped tests.
115
        tests.default_transport,
1534.4.46 by Robert Collins
Nearly complete .bzr/checkout splitout.
116
        # None here will cause a readonly decorator to be created
117
        # by the TestCaseWithTransport.get_readonly_transport method.
118
        None,
4505.5.3 by Robert Collins
Test infrastructure for testing all inventory delta applications and fix CHK inventories to reject repeated file ids in deltas.
119
        workingtree_formats()
120
        )
3302.9.16 by Vincent Ladeuil
bzrlib.tests.workingtree_implementations switched from
121
3302.9.27 by Vincent Ladeuil
Fixed as per Ian's review.
122
    # add the tests for the sub modules
4285.2.1 by Vincent Ladeuil
Cleanup test imports and use features to better track skipped tests.
123
    return tests.multiply_tests(
4084.5.1 by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters.
124
        loader.loadTestsFromModuleNames(test_workingtree_implementations),
125
        scenarios, standard_tests)