/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
5387.2.7 by John Arbash Meinel
Merge bzr.dev 5444 to resolve some small text conflicts.
1
# Copyright (C) 2010 Canonical Ltd
5363.2.29 by Jelmer Vernooij
Move some bzrdir-specific tests to bzrlib.tests.per_bzrdir.
2
# Authors: Robert Collins <robert.collins@canonical.com>
3
#          Jelmer Vernooij <jelmer.vernooij@canonical.com>
4
# -*- coding: utf-8 -*-
5
#
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
20
21
"""BzrDir implementation tests for bzr.
22
23
These test the conformance of all the bzrdir variations to the expected API.
24
Specific tests for individual formats are in the tests/test_bzrdir.py file
25
rather than in tests/per_branch/*.py. Generic control directory tests not
26
specific to BzrDir are in tests/per_controldir/*.py.
27
"""
28
6670.4.1 by Jelmer Vernooij
Update imports.
29
from breezy.bzr.bzrdir import BzrDirFormat
6622.1.34 by Jelmer Vernooij
Rename brzlib => breezy.
30
from breezy.controldir import ControlDirFormat
31
from breezy.tests import (
5363.2.29 by Jelmer Vernooij
Move some bzrdir-specific tests to bzrlib.tests.per_bzrdir.
32
    default_transport,
33
    multiply_tests,
34
    test_server,
35
    TestCaseWithTransport,
36
    )
6622.1.34 by Jelmer Vernooij
Rename brzlib => breezy.
37
from breezy.tests.per_controldir import make_scenarios
38
from breezy.transport import memory
5363.2.29 by Jelmer Vernooij
Move some bzrdir-specific tests to bzrlib.tests.per_bzrdir.
39
40
41
class TestCaseWithBzrDir(TestCaseWithTransport):
42
43
    def setUp(self):
44
        super(TestCaseWithBzrDir, self).setUp()
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
45
        self.controldir = None
5363.2.29 by Jelmer Vernooij
Move some bzrdir-specific tests to bzrlib.tests.per_bzrdir.
46
47
    def get_bzrdir(self):
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
48
        if self.controldir is None:
6653.6.5 by Jelmer Vernooij
Rename make_bzrdir to make_controldir.
49
            self.controldir = self.make_controldir(None)
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
50
        return self.controldir
5363.2.29 by Jelmer Vernooij
Move some bzrdir-specific tests to bzrlib.tests.per_bzrdir.
51
6155.6.11 by Jelmer Vernooij
Fix per_controldir/per_bzrdir tests.
52
    def get_default_format(self):
53
        return self.bzrdir_format
5363.2.29 by Jelmer Vernooij
Move some bzrdir-specific tests to bzrlib.tests.per_bzrdir.
54
55
6625.1.5 by Martin
Drop custom load_tests implementation and use unittest signature
56
def load_tests(loader, standard_tests, pattern):
5363.2.29 by Jelmer Vernooij
Move some bzrdir-specific tests to bzrlib.tests.per_bzrdir.
57
    test_per_bzrdir = [
6622.1.34 by Jelmer Vernooij
Rename brzlib => breezy.
58
        'breezy.tests.per_bzrdir.test_bzrdir',
5363.2.29 by Jelmer Vernooij
Move some bzrdir-specific tests to bzrlib.tests.per_bzrdir.
59
        ]
60
    submod_tests = loader.loadTestsFromModuleNames(test_per_bzrdir)
61
    formats = [format for format in ControlDirFormat.known_formats()
62
               if isinstance(format, BzrDirFormat)]
63
    scenarios = make_scenarios(
64
        default_transport,
65
        None,
66
        # None here will cause a readonly decorator to be created
67
        # by the TestCaseWithTransport.get_readonly_transport method.
68
        None,
69
        formats)
70
    # This will always add scenarios using the smart server.
6670.4.14 by Jelmer Vernooij
Move remote to breezy.bzr.
71
    from breezy.bzr.remote import RemoteBzrDirFormat
5363.2.29 by Jelmer Vernooij
Move some bzrdir-specific tests to bzrlib.tests.per_bzrdir.
72
    # test the remote server behaviour when backed with a MemoryTransport
73
    # Once for the current version
74
    scenarios.extend(make_scenarios(
75
        memory.MemoryServer,
76
        test_server.SmartTCPServer_for_testing,
77
        test_server.ReadonlySmartTCPServer_for_testing,
78
        [(RemoteBzrDirFormat())],
79
        name_suffix='-default'))
80
    # And once with < 1.6 - the 'v2' protocol.
81
    scenarios.extend(make_scenarios(
82
        memory.MemoryServer,
83
        test_server.SmartTCPServer_for_testing_v2_only,
84
        test_server.ReadonlySmartTCPServer_for_testing_v2_only,
85
        [(RemoteBzrDirFormat())],
86
        name_suffix='-v2'))
87
    # add the tests for the sub modules
88
    return multiply_tests(submod_tests, scenarios, standard_tests)