/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
1534.4.46 by Robert Collins
Nearly complete .bzr/checkout splitout.
22
rather than in tests/workingtree_implementations/*.py.
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
    )
30
from bzrlib.tests import bzrdir_implementations
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
4285.2.1 by Vincent Ladeuil
Cleanup test imports and use features to better track skipped tests.
53
class TestCaseWithWorkingTree(bzrdir_implementations.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
4084.5.1 by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters.
62
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.
63
    test_names = [
64
        'add_reference',
65
        'add',
66
        'basis_inventory',
67
        'basis_tree',
68
        'break_lock',
69
        'changes_from',
70
        'check',
71
        'content_filters',
72
        'commit',
73
        'eol_conversion',
74
        'executable',
75
        'flush',
76
        'get_file_with_stat',
77
        'get_file_mtime',
78
        'get_parent_ids',
79
        'inv',
80
        'is_control_filename',
81
        'is_ignored',
82
        'locking',
83
        'merge_from_branch',
84
        'mkdir',
85
        'move',
86
        'nested_specifics',
87
        'parents',
88
        'paths2ids',
89
        'pull',
90
        'put_file',
91
        'readonly',
92
        'read_working_inventory',
93
        'remove',
94
        'rename_one',
95
        'revision_tree',
96
        'set_root_id',
97
        'smart_add',
98
        'uncommit',
99
        'unversion',
100
        'views',
101
        'walkdirs',
102
        'workingtree',
103
        ]
1534.4.46 by Robert Collins
Nearly complete .bzr/checkout splitout.
104
    test_workingtree_implementations = [
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.
105
        'bzrlib.tests.workingtree_implementations.test_' + name for
106
        name in test_names]
3302.9.16 by Vincent Ladeuil
bzrlib.tests.workingtree_implementations switched from
107
4084.5.1 by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters.
108
    scenarios = make_scenarios(
4285.2.1 by Vincent Ladeuil
Cleanup test imports and use features to better track skipped tests.
109
        tests.default_transport,
1534.4.46 by Robert Collins
Nearly complete .bzr/checkout splitout.
110
        # None here will cause a readonly decorator to be created
111
        # by the TestCaseWithTransport.get_readonly_transport method.
112
        None,
4285.2.1 by Vincent Ladeuil
Cleanup test imports and use features to better track skipped tests.
113
        workingtree.WorkingTreeFormat._formats.values()
114
        + workingtree._legacy_formats)
3302.9.16 by Vincent Ladeuil
bzrlib.tests.workingtree_implementations switched from
115
3302.9.27 by Vincent Ladeuil
Fixed as per Ian's review.
116
    # add the tests for the sub modules
4285.2.1 by Vincent Ladeuil
Cleanup test imports and use features to better track skipped tests.
117
    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.
118
        loader.loadTestsFromModuleNames(test_workingtree_implementations),
119
        scenarios, standard_tests)