bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
2052.3.2
by John Arbash Meinel
Change Copyright .. by Canonical to Copyright ... Canonical |
1 |
# Copyright (C) 2006 Canonical Ltd
|
|
1534.4.39
by Robert Collins
Basic BzrDir support. |
2 |
# Authors: Robert Collins <robert.collins@canonical.com>
|
3 |
# -*- coding: utf-8 -*-
|
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
4 |
#
|
|
1534.4.39
by Robert Collins
Basic BzrDir support. |
5 |
# This program is free software; you can redistribute it and/or modify
|
6 |
# it under the terms of the GNU General Public License as published by
|
|
7 |
# the Free Software Foundation; either version 2 of the License, or
|
|
8 |
# (at your option) any later version.
|
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
9 |
#
|
|
1534.4.39
by Robert Collins
Basic BzrDir support. |
10 |
# This program is distributed in the hope that it will be useful,
|
11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
# GNU General Public License for more details.
|
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
14 |
#
|
|
1534.4.39
by Robert Collins
Basic BzrDir support. |
15 |
# You should have received a copy of the GNU General Public License
|
16 |
# along with this program; if not, write to the Free Software
|
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
17 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
1534.4.39
by Robert Collins
Basic BzrDir support. |
18 |
|
19 |
||
20 |
"""BzrDir implementation tests for bzr.
|
|
21 |
||
22 |
These test the conformance of all the bzrdir variations to the expected API.
|
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
23 |
Specific tests for individual formats are in the tests/test_bzrdir.py file
|
|
1534.4.39
by Robert Collins
Basic BzrDir support. |
24 |
rather than in tests/branch_implementations/*.py.
|
25 |
"""
|
|
26 |
||
|
2553.2.7
by Robert Collins
And overhaul BzrDirTestProviderAdapter too. |
27 |
from bzrlib.bzrdir import BzrDirFormat |
|
1534.4.39
by Robert Collins
Basic BzrDir support. |
28 |
from bzrlib.tests import ( |
29 |
default_transport, |
|
|
4084.5.1
by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters. |
30 |
multiply_tests, |
|
2475.3.1
by John Arbash Meinel
Fix bug #75721. Update the BzrDir api to add clone_on_transport() |
31 |
TestCaseWithTransport, |
|
1534.4.39
by Robert Collins
Basic BzrDir support. |
32 |
)
|
|
2018.5.42
by Robert Collins
Various hopefully improvements, but wsgi is broken, handing over to spiv :). |
33 |
from bzrlib.transport.memory import MemoryServer |
|
1534.4.39
by Robert Collins
Basic BzrDir support. |
34 |
|
35 |
||
|
4084.5.1
by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters. |
36 |
def make_scenarios(vfs_factory, transport_server, transport_readonly_server, |
37 |
formats, name_suffix=''): |
|
38 |
"""Transform the input to a list of scenarios. |
|
|
2553.2.7
by Robert Collins
And overhaul BzrDirTestProviderAdapter too. |
39 |
|
|
4084.5.1
by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters. |
40 |
:param formats: A list of bzrdir_format objects.
|
41 |
:param vfs_server: A factory to create a Transport Server which has
|
|
42 |
all the VFS methods working, and is writable.
|
|
|
2553.2.7
by Robert Collins
And overhaul BzrDirTestProviderAdapter too. |
43 |
"""
|
|
4084.5.1
by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters. |
44 |
result = [] |
45 |
for format in formats: |
|
46 |
scenario_name = format.__class__.__name__ |
|
47 |
scenario_name += name_suffix |
|
48 |
scenario = (scenario_name, { |
|
49 |
"vfs_transport_factory": vfs_factory, |
|
50 |
"transport_server": transport_server, |
|
51 |
"transport_readonly_server": transport_readonly_server, |
|
52 |
"bzrdir_format": format, |
|
53 |
})
|
|
54 |
result.append(scenario) |
|
55 |
return result |
|
|
2553.2.7
by Robert Collins
And overhaul BzrDirTestProviderAdapter too. |
56 |
|
57 |
||
|
2475.3.1
by John Arbash Meinel
Fix bug #75721. Update the BzrDir api to add clone_on_transport() |
58 |
class TestCaseWithBzrDir(TestCaseWithTransport): |
59 |
||
60 |
def setUp(self): |
|
61 |
super(TestCaseWithBzrDir, self).setUp() |
|
62 |
self.bzrdir = None |
|
63 |
||
64 |
def get_bzrdir(self): |
|
65 |
if self.bzrdir is None: |
|
66 |
self.bzrdir = self.make_bzrdir(None) |
|
67 |
return self.bzrdir |
|
68 |
||
69 |
def make_bzrdir(self, relpath, format=None): |
|
|
3242.2.14
by Aaron Bentley
Update from review comments |
70 |
if format is None: |
71 |
format = self.bzrdir_format |
|
|
2475.3.1
by John Arbash Meinel
Fix bug #75721. Update the BzrDir api to add clone_on_transport() |
72 |
return super(TestCaseWithBzrDir, self).make_bzrdir( |
|
3242.2.14
by Aaron Bentley
Update from review comments |
73 |
relpath, format=format) |
|
2475.3.1
by John Arbash Meinel
Fix bug #75721. Update the BzrDir api to add clone_on_transport() |
74 |
|
75 |
||
|
4084.5.1
by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters. |
76 |
def load_tests(standard_tests, module, loader): |
|
1534.4.39
by Robert Collins
Basic BzrDir support. |
77 |
test_bzrdir_implementations = [ |
78 |
'bzrlib.tests.bzrdir_implementations.test_bzrdir', |
|
|
3978.3.16
by Jelmer Vernooij
Add some smoke tests for BzrDir.push_branch(). |
79 |
'bzrlib.tests.bzrdir_implementations.test_push', |
|
1534.4.39
by Robert Collins
Basic BzrDir support. |
80 |
]
|
|
4084.5.1
by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters. |
81 |
submod_tests = loader.loadTestsFromModuleNames(test_bzrdir_implementations) |
|
1733.1.3
by Robert Collins
Extend the test suite to run bzrdir conformance tests on non .bzr based control dirs. |
82 |
formats = BzrDirFormat.known_formats() |
|
4084.5.1
by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters. |
83 |
scenarios = make_scenarios( |
|
1534.4.39
by Robert Collins
Basic BzrDir support. |
84 |
default_transport, |
|
2018.5.42
by Robert Collins
Various hopefully improvements, but wsgi is broken, handing over to spiv :). |
85 |
None, |
|
1534.4.39
by Robert Collins
Basic BzrDir support. |
86 |
# None here will cause a readonly decorator to be created
|
87 |
# by the TestCaseWithTransport.get_readonly_transport method.
|
|
88 |
None, |
|
|
1733.1.3
by Robert Collins
Extend the test suite to run bzrdir conformance tests on non .bzr based control dirs. |
89 |
formats) |
|
4084.5.1
by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters. |
90 |
# This will always add scenarios using the smart server.
|
|
3302.9.8
by Vincent Ladeuil
bzrlib.tests.bzrdir_implementations switched from test_suite() to load_tests(). |
91 |
from bzrlib.smart.server import ( |
|
3453.5.1
by Andrew Bennetts
Add {bzrdir,repository,branch}_implementations tests for Remote objects using protocol v2 and pre-1.6 RPCs. |
92 |
ReadonlySmartTCPServer_for_testing, |
93 |
ReadonlySmartTCPServer_for_testing_v2_only, |
|
|
3302.9.8
by Vincent Ladeuil
bzrlib.tests.bzrdir_implementations switched from test_suite() to load_tests(). |
94 |
SmartTCPServer_for_testing, |
|
3453.5.1
by Andrew Bennetts
Add {bzrdir,repository,branch}_implementations tests for Remote objects using protocol v2 and pre-1.6 RPCs. |
95 |
SmartTCPServer_for_testing_v2_only, |
|
3302.9.8
by Vincent Ladeuil
bzrlib.tests.bzrdir_implementations switched from test_suite() to load_tests(). |
96 |
)
|
|
1752.2.87
by Andrew Bennetts
Make tests pass. |
97 |
from bzrlib.remote import RemoteBzrDirFormat |
|
4084.5.1
by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters. |
98 |
# test the remote server behaviour when backed with a MemoryTransport
|
99 |
# Once for the current version
|
|
100 |
scenarios.extend(make_scenarios( |
|
|
2018.5.42
by Robert Collins
Various hopefully improvements, but wsgi is broken, handing over to spiv :). |
101 |
MemoryServer, |
102 |
SmartTCPServer_for_testing, |
|
103 |
ReadonlySmartTCPServer_for_testing, |
|
|
3453.5.1
by Andrew Bennetts
Add {bzrdir,repository,branch}_implementations tests for Remote objects using protocol v2 and pre-1.6 RPCs. |
104 |
[(RemoteBzrDirFormat())], |
|
4084.5.1
by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters. |
105 |
name_suffix='-default')) |
106 |
# And once with < 1.6 - the 'v2' protocol.
|
|
107 |
scenarios.extend(make_scenarios( |
|
|
3453.5.1
by Andrew Bennetts
Add {bzrdir,repository,branch}_implementations tests for Remote objects using protocol v2 and pre-1.6 RPCs. |
108 |
MemoryServer, |
109 |
SmartTCPServer_for_testing_v2_only, |
|
110 |
ReadonlySmartTCPServer_for_testing_v2_only, |
|
111 |
[(RemoteBzrDirFormat())], |
|
|
4084.5.1
by Robert Collins
Bulk update all test adaptation into a single approach, using multiply_tests rather than test adapters. |
112 |
name_suffix='-v2')) |
113 |
# add the tests for the sub modules
|
|
114 |
return multiply_tests(submod_tests, scenarios, standard_tests) |