/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Robert Collins
  • Date: 2007-07-04 08:08:13 UTC
  • mfrom: (2572 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2587.
  • Revision ID: robertc@robertcollins.net-20070704080813-wzebx0r88fvwj5rq
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 by Canonical Ltd
2
 
# Authors: Robert Collins <robert.collins@canonical.com>
3
 
# -*- coding: utf-8 -*-
 
1
# Copyright (C) 2006, 2007 Canonical Ltd
4
2
#
5
3
# This program is free software; you can redistribute it and/or modify
6
4
# it under the terms of the GNU General Public License as published by
30
28
                          adapt_modules,
31
29
                          default_transport,
32
30
                          TestLoader,
 
31
                          TestScenarioApplier,
33
32
                          TestSuite,
34
33
                          )
35
34
from bzrlib.tests.bzrdir_implementations.test_bzrdir import TestCaseWithBzrDir
36
35
from bzrlib.workingtree import (WorkingTreeFormat,
37
 
                                WorkingTreeTestProviderAdapter,
38
36
                                _legacy_formats,
39
37
                                )
40
38
 
41
39
 
 
40
class WorkingTreeTestProviderAdapter(TestScenarioApplier):
 
41
    """A tool to generate a suite testing multiple workingtree formats at once.
 
42
 
 
43
    This is done by copying the test once for each transport and injecting
 
44
    the transport_server, transport_readonly_server, and workingtree_format
 
45
    classes into each copy. Each copy is also given a new id() to make it
 
46
    easy to identify.
 
47
    """
 
48
 
 
49
    def __init__(self, transport_server, transport_readonly_server, formats):
 
50
        self._transport_server = transport_server
 
51
        self._transport_readonly_server = transport_readonly_server
 
52
        self.scenarios = self.formats_to_scenarios(formats)
 
53
    
 
54
    def formats_to_scenarios(self, formats):
 
55
        """Transform the input formats to a list of scenarios.
 
56
 
 
57
        :param formats: A list of (workingtree_format, bzrdir_format).
 
58
        """
 
59
    
 
60
        result = []
 
61
        for workingtree_format, bzrdir_format in formats:
 
62
            scenario = (workingtree_format.__class__.__name__, {
 
63
                "transport_server":self._transport_server,
 
64
                "transport_readonly_server":self._transport_readonly_server,
 
65
                "bzrdir_format":bzrdir_format,
 
66
                "workingtree_format":workingtree_format,
 
67
                })
 
68
            result.append(scenario)
 
69
        return result
 
70
 
 
71
 
42
72
class TestCaseWithWorkingTree(TestCaseWithBzrDir):
43
73
 
44
74
    def make_branch_and_tree(self, relpath, format=None):
51
81
def test_suite():
52
82
    result = TestSuite()
53
83
    test_workingtree_implementations = [
 
84
        'bzrlib.tests.workingtree_implementations.test_add_reference',
 
85
        'bzrlib.tests.workingtree_implementations.test_add',
54
86
        'bzrlib.tests.workingtree_implementations.test_basis_inventory',
 
87
        'bzrlib.tests.workingtree_implementations.test_basis_tree',
55
88
        'bzrlib.tests.workingtree_implementations.test_break_lock',
56
89
        'bzrlib.tests.workingtree_implementations.test_changes_from',
57
90
        'bzrlib.tests.workingtree_implementations.test_commit',
58
91
        'bzrlib.tests.workingtree_implementations.test_executable',
 
92
        'bzrlib.tests.workingtree_implementations.test_flush',
 
93
        'bzrlib.tests.workingtree_implementations.test_get_file_mtime',
59
94
        'bzrlib.tests.workingtree_implementations.test_get_parent_ids',
 
95
        'bzrlib.tests.workingtree_implementations.test_inv',
60
96
        'bzrlib.tests.workingtree_implementations.test_is_control_filename',
61
97
        'bzrlib.tests.workingtree_implementations.test_is_ignored',
62
98
        'bzrlib.tests.workingtree_implementations.test_locking',
63
99
        'bzrlib.tests.workingtree_implementations.test_merge_from_branch',
 
100
        'bzrlib.tests.workingtree_implementations.test_mkdir',
 
101
        'bzrlib.tests.workingtree_implementations.test_move',
 
102
        'bzrlib.tests.workingtree_implementations.test_nested_specifics',
64
103
        'bzrlib.tests.workingtree_implementations.test_parents',
 
104
        'bzrlib.tests.workingtree_implementations.test_paths2ids',
65
105
        'bzrlib.tests.workingtree_implementations.test_pull',
66
106
        'bzrlib.tests.workingtree_implementations.test_put_file',
67
 
        'bzrlib.tests.workingtree_implementations.test_mkdir',
 
107
        'bzrlib.tests.workingtree_implementations.test_readonly',
 
108
        'bzrlib.tests.workingtree_implementations.test_read_working_inventory',
 
109
        'bzrlib.tests.workingtree_implementations.test_remove',
 
110
        'bzrlib.tests.workingtree_implementations.test_rename_one',
 
111
        'bzrlib.tests.workingtree_implementations.test_revision_tree',
 
112
        'bzrlib.tests.workingtree_implementations.test_set_root_id',
 
113
        'bzrlib.tests.workingtree_implementations.test_smart_add',
68
114
        'bzrlib.tests.workingtree_implementations.test_unversion',
 
115
        'bzrlib.tests.workingtree_implementations.test_walkdirs',
69
116
        'bzrlib.tests.workingtree_implementations.test_workingtree',
70
117
        ]
71
118
    adapter = WorkingTreeTestProviderAdapter(