/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
5630.2.2 by John Arbash Meinel
Start fleshing out the design. Something weird is causing my tests to all fail.
1
# Copyright (C) 2006-2011 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
5128.1.1 by Vincent Ladeuil
Uncontroversial cleanups, mostly comments
20
This 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 (
5409.1.2 by Vincent Ladeuil
Make make_branch_builder available to all per_workingtree tests.
26
    branchbuilder,
4285.2.1 by Vincent Ladeuil
Cleanup test imports and use features to better track skipped tests.
27
    errors,
28
    tests,
29
    workingtree,
30
    )
5363.2.2 by Jelmer Vernooij
Rename per_bzrdir => per_controldir.
31
from bzrlib.tests import per_controldir
1534.5.5 by Robert Collins
Move is_control_file into WorkingTree.is_control_filename and test.
32
33
4084.5.1 by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters.
34
def make_scenarios(transport_server, transport_readonly_server, formats):
35
    result = []
36
    for workingtree_format in formats:
37
        result.append((workingtree_format.__class__.__name__,
4285.2.1 by Vincent Ladeuil
Cleanup test imports and use features to better track skipped tests.
38
                       make_scenario(transport_server,
39
                                     transport_readonly_server,
40
                                     workingtree_format)))
4084.5.1 by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters.
41
    return result
42
43
44
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.
45
                  workingtree_format):
4084.5.1 by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters.
46
    return {
47
        "transport_server": transport_server,
48
        "transport_readonly_server": transport_readonly_server,
49
        "bzrdir_format": workingtree_format._matchingbzrdir,
50
        "workingtree_format": workingtree_format,
51
        }
3363.1.1 by Aaron Bentley
Refactor intertree scenario creation
52
2553.2.10 by Robert Collins
And overhaul WorkingTreeTestProviderAdapter too.
53
5363.2.18 by Jelmer Vernooij
Rename TestCaseWithBzrDir -> TestCaseWithControlDir.
54
class TestCaseWithWorkingTree(per_controldir.TestCaseWithControlDir):
1666.1.4 by Robert Collins
* 'Metadir' is now the default disk format. This improves behaviour in
55
56
    def make_branch_and_tree(self, relpath, format=None):
57
        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.
58
        made_control.create_repository()
59
        made_control.create_branch()
60
        return self.workingtree_format.initialize(made_control)
1534.4.46 by Robert Collins
Nearly complete .bzr/checkout splitout.
61
5409.1.2 by Vincent Ladeuil
Make make_branch_builder available to all per_workingtree tests.
62
    def make_branch_builder(self, relpath, format=None):
63
        if format is None:
64
            format = self.bzrdir_format
5516.1.1 by Vincent Ladeuil
TestCaseWithWorkingTree.make_branch_builder respects its relpath parameter.
65
        builder = branchbuilder.BranchBuilder(self.get_transport(relpath),
5409.1.2 by Vincent Ladeuil
Make make_branch_builder available to all per_workingtree tests.
66
                                              format=format)
67
        return builder
68
1534.4.46 by Robert Collins
Nearly complete .bzr/checkout splitout.
69
4084.5.1 by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters.
70
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.
71
    test_names = [
72
        'add_reference',
73
        'add',
4523.1.5 by Vincent Ladeuil
Fixed as asked in review.
74
        '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.
75
        'basis_inventory',
76
        'basis_tree',
77
        'break_lock',
78
        'changes_from',
79
        'check',
5630.2.2 by John Arbash Meinel
Start fleshing out the design. Something weird is causing my tests to all fail.
80
        'check_state',
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.
81
        'content_filters',
82
        'commit',
83
        'eol_conversion',
84
        'executable',
85
        'flush',
86
        'get_file_mtime',
87
        'get_parent_ids',
88
        'inv',
89
        'is_control_filename',
90
        'is_ignored',
91
        'locking',
92
        'merge_from_branch',
93
        'mkdir',
94
        'move',
95
        'nested_specifics',
96
        'parents',
97
        'paths2ids',
98
        'pull',
99
        'put_file',
100
        'readonly',
101
        'read_working_inventory',
102
        'remove',
103
        'rename_one',
104
        'revision_tree',
105
        'set_root_id',
106
        'smart_add',
4634.157.4 by Martin Pool
Add a basic (already passing) test for smart_add of a symlink
107
        'symlinks',
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.
108
        'uncommit',
109
        'unversion',
110
        'views',
111
        'walkdirs',
112
        'workingtree',
113
        ]
1534.4.46 by Robert Collins
Nearly complete .bzr/checkout splitout.
114
    test_workingtree_implementations = [
4332.3.32 by Robert Collins
Merge bzr.dev.
115
        '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.
116
        name in test_names]
3302.9.16 by Vincent Ladeuil
bzrlib.tests.workingtree_implementations switched from
117
4084.5.1 by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters.
118
    scenarios = make_scenarios(
4285.2.1 by Vincent Ladeuil
Cleanup test imports and use features to better track skipped tests.
119
        tests.default_transport,
1534.4.46 by Robert Collins
Nearly complete .bzr/checkout splitout.
120
        # None here will cause a readonly decorator to be created
121
        # by the TestCaseWithTransport.get_readonly_transport method.
122
        None,
5662.3.1 by Jelmer Vernooij
Add WorkingTreeFormatRegistry.
123
        workingtree.format_registry._get_all()
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.
124
        )
3302.9.16 by Vincent Ladeuil
bzrlib.tests.workingtree_implementations switched from
125
3302.9.27 by Vincent Ladeuil
Fixed as per Ian's review.
126
    # add the tests for the sub modules
4285.2.1 by Vincent Ladeuil
Cleanup test imports and use features to better track skipped tests.
127
    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.
128
        loader.loadTestsFromModuleNames(test_workingtree_implementations),
129
        scenarios, standard_tests)