bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
5143.1.1
by Jelmer Vernooij
Add separate tests for BzrDirs with colocated branch support and |
1 |
# Copyright (C) 2010 Canonical Ltd
|
2 |
#
|
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
16 |
||
17 |
"""Tests for bazaar control directories that do not support colocated branches.
|
|
18 |
||
19 |
Colocated branch support is optional, and when it is not supported the methods
|
|
20 |
and attributes colocated branch support added should fail in known ways.
|
|
21 |
"""
|
|
22 |
||
|
5609.9.1
by Martin
Blindly change all users of get_transport to address the function via the transport module |
23 |
from bzrlib import ( |
24 |
errors, |
|
|
5609.9.3
by Vincent Ladeuil
Use self.get_transport() in per_controldir_colo and some cleanup. |
25 |
tests, |
|
5609.9.1
by Martin
Blindly change all users of get_transport to address the function via the transport module |
26 |
transport, |
27 |
)
|
|
|
5143.1.1
by Jelmer Vernooij
Add separate tests for BzrDirs with colocated branch support and |
28 |
from bzrlib.tests import ( |
|
5609.9.3
by Vincent Ladeuil
Use self.get_transport() in per_controldir_colo and some cleanup. |
29 |
per_controldir, |
30 |
)
|
|
31 |
||
32 |
||
33 |
class TestNoColocatedSupport(per_controldir.TestCaseWithControlDir): |
|
|
5143.1.1
by Jelmer Vernooij
Add separate tests for BzrDirs with colocated branch support and |
34 |
|
|
5147.4.1
by Jelmer Vernooij
Pass branch names in more places. |
35 |
def make_bzrdir_with_repo(self): |
|
5143.1.1
by Jelmer Vernooij
Add separate tests for BzrDirs with colocated branch support and |
36 |
# a bzrdir can construct a branch and repository for itself.
|
37 |
if not self.bzrdir_format.is_supported(): |
|
38 |
# unsupported formats are not loopback testable
|
|
39 |
# because the default open will not open them and
|
|
40 |
# they may not be initializable.
|
|
|
5609.9.3
by Vincent Ladeuil
Use self.get_transport() in per_controldir_colo and some cleanup. |
41 |
raise tests.TestNotApplicable('Control dir format not supported') |
42 |
t = self.get_transport() |
|
|
5143.1.1
by Jelmer Vernooij
Add separate tests for BzrDirs with colocated branch support and |
43 |
made_control = self.bzrdir_format.initialize(t.base) |
44 |
made_repo = made_control.create_repository() |
|
|
5147.4.1
by Jelmer Vernooij
Pass branch names in more places. |
45 |
return made_control |
46 |
||
47 |
def test_destroy_colocated_branch(self): |
|
48 |
branch = self.make_branch('branch') |
|
49 |
# Colocated branches should not be supported *or*
|
|
50 |
# destroy_branch should not be supported at all
|
|
51 |
self.assertRaises( |
|
52 |
(errors.NoColocatedBranchSupport, errors.UnsupportedOperation), |
|
53 |
branch.bzrdir.destroy_branch, 'colo') |
|
54 |
||
55 |
def test_create_colo_branch(self): |
|
56 |
made_control = self.make_bzrdir_with_repo() |
|
|
5143.1.1
by Jelmer Vernooij
Add separate tests for BzrDirs with colocated branch support and |
57 |
self.assertRaises(errors.NoColocatedBranchSupport, |
58 |
made_control.create_branch, "colo") |
|
59 |
||
|
5699.4.2
by Jelmer Vernooij
In per_controldir_colo, test open_branch rather than get_branch_transport. |
60 |
def test_open_branch(self): |
|
5147.4.1
by Jelmer Vernooij
Pass branch names in more places. |
61 |
made_control = self.make_bzrdir_with_repo() |
62 |
self.assertRaises(errors.NoColocatedBranchSupport, |
|
|
5699.4.2
by Jelmer Vernooij
In per_controldir_colo, test open_branch rather than get_branch_transport. |
63 |
made_control.open_branch, name="colo") |
|
5147.4.3
by Jelmer Vernooij
Support branch name argument to BzrDir.get_branch_reference. |
64 |
|
65 |
def test_get_branch_reference(self): |
|
66 |
made_control = self.make_bzrdir_with_repo() |
|
67 |
self.assertRaises(errors.NoColocatedBranchSupport, |
|
68 |
made_control.get_branch_reference, "colo") |