~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_interbranch/__init__.py

  • Committer: Robert Collins
  • Date: 2010-06-20 22:54:30 UTC
  • mfrom: (5308 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5309.
  • Revision ID: robertc@robertcollins.net-20100620225430-gzgig1g6ltba5sbk
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
    # test the default InterBranch between format 6 and the current
77
77
    # default format.
78
78
    for optimiser_class in InterBranch._optimisers:
79
 
        format_from_test, format_to_test = \
80
 
            optimiser_class._get_branch_formats_to_test()
81
 
        if format_to_test is not None:
82
 
            result.append((optimiser_class,
83
 
                           format_from_test, format_to_test))
 
79
        for format_from_test, format_to_test in \
 
80
            optimiser_class._get_branch_formats_to_test():
 
81
            result.append((optimiser_class, format_from_test, format_to_test))
84
82
    # if there are specific combinations we want to use, we can add them
85
83
    # here.
86
84
    return result
144
142
        return newbranch.bzrdir
145
143
 
146
144
 
 
145
class StubWithFormat(object):
 
146
    """A stub object used to check that convenience methods call Inter's."""
 
147
 
 
148
    _format = object()
 
149
 
 
150
 
 
151
class StubMatchingInter(object):
 
152
    """An inter for tests.
 
153
 
 
154
    This is not a subclass of InterBranch so that missing methods are caught
 
155
    and added rather than actually trying to do something.
 
156
    """
 
157
 
 
158
    _uses = []
 
159
 
 
160
    def __init__(self, source, target):
 
161
        self.source = source
 
162
        self.target = target
 
163
 
 
164
    @classmethod
 
165
    def is_compatible(klass, source, target):
 
166
        return StubWithFormat._format in (source._format, target._format)
 
167
 
 
168
    def copy_content_into(self, *args, **kwargs):
 
169
        self.__class__._uses.append(
 
170
            (self, 'copy_content_into', args, kwargs))
 
171
 
 
172
 
147
173
def load_tests(standard_tests, module, loader):
148
174
    submod_tests = loader.loadTestsFromModuleNames([
 
175
        'bzrlib.tests.per_interbranch.test_get',
 
176
        'bzrlib.tests.per_interbranch.test_copy_content_into',
149
177
        'bzrlib.tests.per_interbranch.test_pull',
150
178
        'bzrlib.tests.per_interbranch.test_push',
151
179
        'bzrlib.tests.per_interbranch.test_update_revisions',