~bzr/ubuntu/lucid/bzr/beta-ppa

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2010-08-18 04:26:39 UTC
  • mfrom: (129.1.8 packaging-karmic)
  • Revision ID: mbp@sourcefrog.net-20100818042639-mjoxtngyjwiu05fo
* PPA rebuild for lucid.
* PPA rebuild for karmic.
* PPA rebuild onto jaunty.
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009 Canonical Ltd
 
1
# Copyright (C) 2009, 2010 Canonical Ltd
2
2
# -*- coding: utf-8 -*-
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
46
46
    TestCaseWithTransport,
47
47
    multiply_tests,
48
48
    )
49
 
from bzrlib.transport import get_transport
50
49
 
51
50
 
52
51
def make_scenarios(test_list):
76
75
    # test the default InterBranch between format 6 and the current
77
76
    # default format.
78
77
    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))
 
78
        for format_from_test, format_to_test in \
 
79
            optimiser_class._get_branch_formats_to_test():
 
80
            result.append((optimiser_class, format_from_test, format_to_test))
84
81
    # if there are specific combinations we want to use, we can add them
85
82
    # here.
86
83
    return result
144
141
        return newbranch.bzrdir
145
142
 
146
143
 
 
144
class StubWithFormat(object):
 
145
    """A stub object used to check that convenience methods call Inter's."""
 
146
 
 
147
    _format = object()
 
148
 
 
149
 
 
150
class StubMatchingInter(object):
 
151
    """An inter for tests.
 
152
 
 
153
    This is not a subclass of InterBranch so that missing methods are caught
 
154
    and added rather than actually trying to do something.
 
155
    """
 
156
 
 
157
    _uses = []
 
158
 
 
159
    def __init__(self, source, target):
 
160
        self.source = source
 
161
        self.target = target
 
162
 
 
163
    @classmethod
 
164
    def is_compatible(klass, source, target):
 
165
        return StubWithFormat._format in (source._format, target._format)
 
166
 
 
167
    def copy_content_into(self, *args, **kwargs):
 
168
        self.__class__._uses.append(
 
169
            (self, 'copy_content_into', args, kwargs))
 
170
 
 
171
 
147
172
def load_tests(standard_tests, module, loader):
148
173
    submod_tests = loader.loadTestsFromModuleNames([
 
174
        'bzrlib.tests.per_interbranch.test_get',
 
175
        'bzrlib.tests.per_interbranch.test_copy_content_into',
149
176
        'bzrlib.tests.per_interbranch.test_pull',
150
177
        'bzrlib.tests.per_interbranch.test_push',
151
178
        'bzrlib.tests.per_interbranch.test_update_revisions',