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 |
tests, |
28 |
workingtree, |
|
29 |
)
|
|
5363.2.2
by Jelmer Vernooij
Rename per_bzrdir => per_controldir. |
30 |
from bzrlib.tests import per_controldir |
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 |
|
5865.2.1
by Vincent Ladeuil
Add an helper for per_workingtree scenarios that plugins can reuse |
53 |
def wt_scenarios(): |
54 |
"""Returns the scenarios for all registered working trees.
|
|
55 |
||
56 |
This can used by plugins that want to define tests against these working
|
|
57 |
trees.
|
|
58 |
"""
|
|
59 |
scenarios = make_scenarios( |
|
60 |
tests.default_transport, |
|
61 |
# None here will cause a readonly decorator to be created
|
|
62 |
# by the TestCaseWithTransport.get_readonly_transport method.
|
|
63 |
None, |
|
64 |
workingtree.format_registry._get_all() |
|
65 |
)
|
|
66 |
return scenarios |
|
67 |
||
68 |
||
5363.2.18
by Jelmer Vernooij
Rename TestCaseWithBzrDir -> TestCaseWithControlDir. |
69 |
class TestCaseWithWorkingTree(per_controldir.TestCaseWithControlDir): |
1666.1.4
by Robert Collins
* 'Metadir' is now the default disk format. This improves behaviour in |
70 |
|
71 |
def make_branch_and_tree(self, relpath, format=None): |
|
72 |
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. |
73 |
made_control.create_repository() |
74 |
made_control.create_branch() |
|
75 |
return self.workingtree_format.initialize(made_control) |
|
1534.4.46
by Robert Collins
Nearly complete .bzr/checkout splitout. |
76 |
|
5409.1.2
by Vincent Ladeuil
Make make_branch_builder available to all per_workingtree tests. |
77 |
def make_branch_builder(self, relpath, format=None): |
78 |
if format is None: |
|
79 |
format = self.bzrdir_format |
|
5516.1.1
by Vincent Ladeuil
TestCaseWithWorkingTree.make_branch_builder respects its relpath parameter. |
80 |
builder = branchbuilder.BranchBuilder(self.get_transport(relpath), |
5409.1.2
by Vincent Ladeuil
Make make_branch_builder available to all per_workingtree tests. |
81 |
format=format) |
82 |
return builder |
|
83 |
||
1534.4.46
by Robert Collins
Nearly complete .bzr/checkout splitout. |
84 |
|
4084.5.1
by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters. |
85 |
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. |
86 |
test_names = [ |
87 |
'add_reference', |
|
88 |
'add', |
|
4523.1.5
by Vincent Ladeuil
Fixed as asked in review. |
89 |
'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. |
90 |
'basis_inventory', |
91 |
'basis_tree', |
|
92 |
'break_lock', |
|
93 |
'changes_from', |
|
94 |
'check', |
|
5630.2.2
by John Arbash Meinel
Start fleshing out the design. Something weird is causing my tests to all fail. |
95 |
'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. |
96 |
'content_filters', |
97 |
'commit', |
|
98 |
'eol_conversion', |
|
99 |
'executable', |
|
100 |
'flush', |
|
101 |
'get_file_mtime', |
|
102 |
'get_parent_ids', |
|
103 |
'inv', |
|
104 |
'is_control_filename', |
|
105 |
'is_ignored', |
|
106 |
'locking', |
|
107 |
'merge_from_branch', |
|
108 |
'mkdir', |
|
109 |
'move', |
|
110 |
'nested_specifics', |
|
111 |
'parents', |
|
112 |
'paths2ids', |
|
113 |
'pull', |
|
114 |
'put_file', |
|
115 |
'readonly', |
|
116 |
'read_working_inventory', |
|
117 |
'remove', |
|
118 |
'rename_one', |
|
119 |
'revision_tree', |
|
120 |
'set_root_id', |
|
121 |
'smart_add', |
|
4634.157.4
by Martin Pool
Add a basic (already passing) test for smart_add of a symlink |
122 |
'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. |
123 |
'uncommit', |
124 |
'unversion', |
|
125 |
'views', |
|
126 |
'walkdirs', |
|
127 |
'workingtree', |
|
128 |
]
|
|
1534.4.46
by Robert Collins
Nearly complete .bzr/checkout splitout. |
129 |
test_workingtree_implementations = [ |
4332.3.32
by Robert Collins
Merge bzr.dev. |
130 |
'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. |
131 |
name in test_names] |
3302.9.16
by Vincent Ladeuil
bzrlib.tests.workingtree_implementations switched from |
132 |
|
5865.2.1
by Vincent Ladeuil
Add an helper for per_workingtree scenarios that plugins can reuse |
133 |
scenarios = wt_scenarios() |
3302.9.16
by Vincent Ladeuil
bzrlib.tests.workingtree_implementations switched from |
134 |
|
3302.9.27
by Vincent Ladeuil
Fixed as per Ian's review. |
135 |
# add the tests for the sub modules
|
4285.2.1
by Vincent Ladeuil
Cleanup test imports and use features to better track skipped tests. |
136 |
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. |
137 |
loader.loadTestsFromModuleNames(test_workingtree_implementations), |
138 |
scenarios, standard_tests) |
|
5865.2.2
by Vincent Ladeuil
Add a smoke test to avoid accidental deletion of the helper in the future. |
139 |
|
140 |
||
141 |
class TestWtScenarios(tests.TestCase): |
|
142 |
||
143 |
def test_protect_wt_scenarios(self): |
|
144 |
# Just make sure we don't accidentally delete the helper again
|
|
145 |
scenarios = wt_scenarios() |