20
20
"""Branch implementation tests for bzr.
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`.
27
27
from bzrlib import (
31
from bzrlib.branch import (BranchFormat,
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
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
def get_default_format(self):
74
format = self.bzrdir_format
75
self.assertEquals(format.get_branch_format(), self.branch_format)
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.
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')
86
def make_branch_builder(self, relpath, format=None):
88
format = self.branch_format._matchingbzrdir
89
return super(TestCaseWithBranch, self).make_branch_builder(
90
relpath, format=format)
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')
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
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.