~bzr-pqm/bzr/bzr.dev

4763.2.4 by John Arbash Meinel
merge bzr.2.1 in preparation for NEWS entry.
1
# Copyright (C) 2009, 2010 Canonical Ltd
4585.1.1 by Jelmer Vernooij
Add foreign branch tests.
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
18
"""Tests specific to foreign branch implementations.
19
20
"""
4585.1.7 by Jelmer Vernooij
Use scenarios and adapters.
21
22
from bzrlib import (
23
    foreign,
24
    tests,
25
    )
26
27
28
def vcs_scenarios():
4585.1.8 by Jelmer Vernooij
Make branch formats provide a factory for particular situations.
29
    scenarios = []
4585.1.7 by Jelmer Vernooij
Use scenarios and adapters.
30
    for name, vcs in foreign.foreign_vcs_registry.iteritems():
4585.1.8 by Jelmer Vernooij
Make branch formats provide a factory for particular situations.
31
        scenarios.append((vcs.__class__.__name__, {
32
            "branch_factory": vcs.branch_format.get_foreign_tests_branch_factory(),
4585.1.16 by Jelmer Vernooij
Add some more basic tests for the repository API.
33
            "repository_factory": vcs.repository_format.get_foreign_tests_repository_factory(),
4585.1.8 by Jelmer Vernooij
Make branch formats provide a factory for particular situations.
34
            "branch_format": vcs.branch_format,
4585.1.11 by Jelmer Vernooij
Add tests for foreign repository formats.
35
            "repository_format": vcs.repository_format,
4585.1.8 by Jelmer Vernooij
Make branch formats provide a factory for particular situations.
36
            }))
37
    return scenarios
4585.1.7 by Jelmer Vernooij
Use scenarios and adapters.
38
39
40
def load_tests(standard_tests, module, loader):
4585.1.8 by Jelmer Vernooij
Make branch formats provide a factory for particular situations.
41
    result = loader.suiteClass()
4585.1.7 by Jelmer Vernooij
Use scenarios and adapters.
42
    per_vcs_mod_names = [
43
        'branch',
4585.1.11 by Jelmer Vernooij
Add tests for foreign repository formats.
44
        'repository',
4585.1.7 by Jelmer Vernooij
Use scenarios and adapters.
45
        ]
46
    sub_tests = loader.loadTestsFromModuleNames(
47
        ['bzrlib.tests.per_foreign_vcs.test_' + name
48
         for name in per_vcs_mod_names])
4585.1.8 by Jelmer Vernooij
Make branch formats provide a factory for particular situations.
49
    tests.multiply_tests(sub_tests, vcs_scenarios(), result)
50
    return result