889
889
operations with another repository - they will always forward to
890
890
InterRepository.get(other).method_name(parameters).
892
# XXX: FIXME: FUTURE: robertc
893
# testing of these probably requires a factory in optimiser type, and
894
# then a test adapter to test each type thoroughly.
893
897
_optimisers = set()
894
898
"""The available optimised InterRepository types."""
958
962
new_test.id = make_new_test_id()
959
963
result.addTest(new_test)
967
class InterRepositoryTestProviderAdapter(object):
968
"""A tool to generate a suite testing multiple inter repository formats.
970
This is done by copying the test once for each interrepo provider and injecting
971
the transport_server, transport_readonly_server, repository_format and
972
repository_to_format classes into each copy.
973
Each copy is also given a new id() to make it easy to identify.
976
def __init__(self, transport_server, transport_readonly_server, formats):
977
self._transport_server = transport_server
978
self._transport_readonly_server = transport_readonly_server
979
self._formats = formats
981
def adapt(self, test):
983
for interrepo_class, repository_format, repository_format_to in self._formats:
984
new_test = deepcopy(test)
985
new_test.transport_server = self._transport_server
986
new_test.transport_readonly_server = self._transport_readonly_server
987
new_test.interrepo_class = interrepo_class
988
new_test.repository_format = repository_format
989
new_test.repository_format_to = repository_format_to
990
def make_new_test_id():
991
new_id = "%s(%s)" % (new_test.id(), interrepo_class.__name__)
992
return lambda: new_id
993
new_test.id = make_new_test_id()
994
result.addTest(new_test)
998
def default_test_list():
999
"""Generate the default list of interrepo permutations to test."""
1001
# test the default InterRepository between format 6 and the current
1003
result.append((InterRepository, RepositoryFormat6(),
1004
RepositoryFormat.get_default_format()))
1005
for optimiser in InterRepository._optimisers:
1006
result.append((optimiser,
1007
optimiser._matching_repo_format,
1008
optimiser._matching_repo_format
1010
# if there are specific combinations we want to use, we can add them