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
|
|
1563.2.21
by Robert Collins
Smoke test for RevisionStore factories creating revision stores. |
2 |
# Authors: Robert Collins <robert.collins@canonical.com>
|
3 |
#
|
|
4 |
# This program is free software; you can redistribute it and/or modify
|
|
5 |
# it under the terms of the GNU General Public License as published by
|
|
6 |
# the Free Software Foundation; either version 2 of the License, or
|
|
7 |
# (at your option) any later version.
|
|
8 |
#
|
|
9 |
# This program is distributed in the hope that it will be useful,
|
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
# GNU General Public License for more details.
|
|
13 |
#
|
|
14 |
# You should have received a copy of the GNU General Public License
|
|
15 |
# along with this program; if not, write to the Free Software
|
|
16 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
17 |
||
18 |
||
19 |
"""RevisionStore implemnetation tests for bzr.
|
|
20 |
||
21 |
These test the conformance of all the revision store implementations to the
|
|
22 |
expected API including generally applicable corner cases.
|
|
23 |
Specific tests for individual cases are in the tests/test_revisionstore.py file
|
|
24 |
rather than in tests/revisionstore_implementations/*.py.
|
|
25 |
"""
|
|
26 |
||
27 |
from bzrlib.tests import ( |
|
28 |
adapt_modules, |
|
29 |
default_transport, |
|
|
2553.2.9
by Robert Collins
And overhaul RevisionStoreTestProviderAdapter too. |
30 |
TestScenarioApplier, |
|
1563.2.21
by Robert Collins
Smoke test for RevisionStore factories creating revision stores. |
31 |
)
|
32 |
||
33 |
||
|
2553.2.9
by Robert Collins
And overhaul RevisionStoreTestProviderAdapter too. |
34 |
class RevisionStoreTestProviderAdapter(TestScenarioApplier): |
35 |
"""A tool to generate a suite testing multiple repository stores. |
|
36 |
||
37 |
This is done by copying the test once for each repository store
|
|
38 |
and injecting the transport_server, transport_readonly_server,
|
|
39 |
and revision-store-factory into each copy.
|
|
40 |
Each copy is also given a new id() to make it easy to identify.
|
|
41 |
"""
|
|
42 |
||
43 |
def __init__(self, transport_server, transport_readonly_server, factories): |
|
44 |
self._transport_server = transport_server |
|
45 |
self._transport_readonly_server = transport_readonly_server |
|
46 |
self.scenarios = self.factories_to_scenarios(factories) |
|
47 |
||
48 |
def factories_to_scenarios(self, factories): |
|
49 |
"""Transform the input factories to a list of scenarios. |
|
50 |
||
51 |
:param factories: A list of factories.
|
|
52 |
"""
|
|
53 |
result = [] |
|
54 |
for factory in factories: |
|
55 |
scenario = (factory, { |
|
56 |
"transport_server":self._transport_server, |
|
57 |
"transport_readonly_server":self._transport_readonly_server, |
|
58 |
"store_factory":factory, |
|
59 |
})
|
|
60 |
result.append(scenario) |
|
61 |
return result |
|
62 |
||
63 |
@staticmethod
|
|
64 |
def default_test_list(): |
|
65 |
"""Generate the default list of revision store permutations to test.""" |
|
66 |
from bzrlib.store.revision.text import TextRevisionStoreTestFactory |
|
67 |
from bzrlib.store.revision.knit import KnitRevisionStoreFactory |
|
68 |
result = [] |
|
69 |
# test the fallback InterVersionedFile from weave to annotated knits
|
|
70 |
result.append(TextRevisionStoreTestFactory()) |
|
71 |
result.append(KnitRevisionStoreFactory()) |
|
72 |
return result |
|
73 |
||
74 |
||
|
3302.9.14
by Vincent Ladeuil
bzrlib.tests.revisionstore_implementations switched from test_suite() to |
75 |
def load_tests(basic_tests, module, loader): |
76 |
result = loader.suiteClass() |
|
77 |
# add the tests for this module
|
|
78 |
result.addTests(basic_tests) |
|
79 |
||
|
1563.2.21
by Robert Collins
Smoke test for RevisionStore factories creating revision stores. |
80 |
test_revisionstore_implementations = [ |
81 |
'bzrlib.tests.revisionstore_implementations.test_all', |
|
82 |
]
|
|
83 |
adapter = RevisionStoreTestProviderAdapter( |
|
84 |
default_transport, |
|
85 |
# None here will cause a readonly decorator to be created
|
|
86 |
# by the TestCaseWithTransport.get_readonly_transport method.
|
|
87 |
None, |
|
88 |
RevisionStoreTestProviderAdapter.default_test_list() |
|
89 |
)
|
|
|
3302.9.27
by Vincent Ladeuil
Fixed as per Ian's review. |
90 |
# add the tests for the sub modules
|
|
1563.2.21
by Robert Collins
Smoke test for RevisionStore factories creating revision stores. |
91 |
adapt_modules(test_revisionstore_implementations, adapter, loader, result) |
92 |
return result |