~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Andrew Bennetts
  • Date: 2010-10-08 08:15:14 UTC
  • mto: This revision was merged to the branch mainline in revision 5498.
  • Revision ID: andrew.bennetts@canonical.com-20101008081514-dviqzrdfwyzsqbz2
Split NEWS into per-release doc/en/release-notes/bzr-*.txt

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2012, 2016 Canonical Ltd
 
1
# Copyright (C) 2006-2010 Canonical Ltd
2
2
# Authors: Robert Collins <robert.collins@canonical.com>
3
3
#          and others
4
4
#
20
20
"""Branch implementation tests for bzr.
21
21
 
22
22
These test the conformance of all the branch variations to the expected API.
23
 
Specific tests for individual formats are in the `tests/test_branch` file
24
 
rather than in `tests/per_branch/*.py`.
 
23
Specific tests for individual formats are in the tests/test_branch file
 
24
rather than in tests/per_branch/*.py.
25
25
"""
26
26
 
27
27
from bzrlib import (
28
28
    errors,
29
29
    tests,
30
30
    )
31
 
from bzrlib.branch import format_registry
32
 
from bzrlib.remote import RemoteBranchFormat
 
31
from bzrlib.branch import (BranchFormat,
 
32
                           _legacy_formats,
 
33
                           )
 
34
from bzrlib.remote import RemoteBranchFormat, RemoteBzrDirFormat
33
35
from bzrlib.tests import test_server
34
36
from bzrlib.tests.per_controldir.test_controldir import TestCaseWithControlDir
35
37
from bzrlib.transport import memory
67
69
 
68
70
    def get_branch(self):
69
71
        if self.branch is None:
70
 
            self.branch = self.make_branch('abranch')
 
72
            self.branch = self.make_branch('')
71
73
        return self.branch
72
74
 
73
 
    def get_default_format(self):
74
 
        format = self.bzrdir_format
75
 
        self.assertEqual(format.get_branch_format(), self.branch_format)
76
 
        return format
77
 
 
78
75
    def make_branch(self, relpath, format=None):
 
76
        if format is not None:
 
77
            return TestCaseWithControlDir.make_branch(self, relpath, format)
 
78
        repo = self.make_repository(relpath)
 
79
        # fixme RBC 20060210 this isnt necessarily a fixable thing,
 
80
        # Skipped is the wrong exception to raise.
79
81
        try:
80
 
            return super(TestCaseWithBranch, self).make_branch(relpath, format)
 
82
            return self.branch_format.initialize(repo.bzrdir)
81
83
        except errors.UninitializableFormat:
82
 
            raise tests.TestNotApplicable('Uninitializable branch format')
 
84
            raise tests.TestSkipped('Uninitializable branch format')
 
85
 
 
86
    def make_branch_builder(self, relpath, format=None):
 
87
        if format is None:
 
88
            format = self.branch_format._matchingbzrdir
 
89
        return super(TestCaseWithBranch, self).make_branch_builder(
 
90
            relpath, format=format)
 
91
 
 
92
    def make_repository(self, relpath, shared=False, format=None):
 
93
        made_control = self.make_bzrdir(relpath, format=format)
 
94
        return made_control.create_repository(shared=shared)
83
95
 
84
96
    def create_tree_with_merge(self):
85
97
        """Create a branch with a simple ancestry.
120
132
    # Generate a list of branch formats and their associated bzrdir formats to
121
133
    # use.
122
134
    combinations = [(format, format._matchingbzrdir) for format in
123
 
         format_registry._get_all()]
 
135
         BranchFormat.get_formats() + _legacy_formats]
124
136
    scenarios = make_scenarios(
125
137
        # None here will cause the default vfs transport server to be used.
126
138
        None,
149
161
 
150
162
def load_tests(standard_tests, module, loader):
151
163
    per_branch_mod_names = [
 
164
        'bound_sftp',
152
165
        'branch',
153
166
        'break_lock',
154
167
        'check',
168
181
        'pull',
169
182
        'push',
170
183
        'reconcile',
 
184
        'revision_history',
171
185
        'revision_id_to_dotted_revno',
172
186
        'revision_id_to_revno',
173
187
        'sprout',