~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil
  • Date: 2017-01-30 14:42:05 UTC
  • mfrom: (6620.1.1 trunk)
  • Revision ID: tarmac-20170130144205-r8fh2xpmiuxyozpv
Merge  2.7 into trunk including fix for bug #1657238 [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2012, 2016 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 (BranchFormat,
32
 
                           _legacy_formats,
33
 
                           )
34
 
from bzrlib.remote import RemoteBranchFormat, RemoteBzrDirFormat
 
31
from bzrlib.branch import format_registry
 
32
from bzrlib.remote import RemoteBranchFormat
35
33
from bzrlib.tests import test_server
36
34
from bzrlib.tests.per_controldir.test_controldir import TestCaseWithControlDir
37
35
from bzrlib.transport import memory
69
67
 
70
68
    def get_branch(self):
71
69
        if self.branch is None:
72
 
            self.branch = self.make_branch('')
 
70
            self.branch = self.make_branch('abranch')
73
71
        return self.branch
74
72
 
 
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
 
75
78
    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.
81
79
        try:
82
 
            return self.branch_format.initialize(repo.bzrdir)
 
80
            return super(TestCaseWithBranch, self).make_branch(relpath, format)
83
81
        except errors.UninitializableFormat:
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)
 
82
            raise tests.TestNotApplicable('Uninitializable branch format')
95
83
 
96
84
    def create_tree_with_merge(self):
97
85
        """Create a branch with a simple ancestry.
132
120
    # Generate a list of branch formats and their associated bzrdir formats to
133
121
    # use.
134
122
    combinations = [(format, format._matchingbzrdir) for format in
135
 
         BranchFormat.get_formats() + _legacy_formats]
 
123
         format_registry._get_all()]
136
124
    scenarios = make_scenarios(
137
125
        # None here will cause the default vfs transport server to be used.
138
126
        None,
161
149
 
162
150
def load_tests(standard_tests, module, loader):
163
151
    per_branch_mod_names = [
164
 
        'bound_sftp',
165
152
        'branch',
166
153
        'break_lock',
167
154
        'check',
181
168
        'pull',
182
169
        'push',
183
170
        'reconcile',
184
 
        'revision_history',
185
171
        'revision_id_to_dotted_revno',
186
172
        'revision_id_to_revno',
187
173
        'sprout',