~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/__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) 2005, 2006 by Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
32
32
                          iter_suite_tests,
33
33
                          )
34
34
from bzrlib.tests.EncodingAdapter import EncodingTestAdapter
 
35
from bzrlib.symbol_versioning import (
 
36
    deprecated_method,
 
37
    zero_eighteen,
 
38
    )
35
39
import bzrlib.ui as ui
36
40
 
37
41
 
44
48
                     'bzrlib.tests.blackbox.test_annotate',
45
49
                     'bzrlib.tests.blackbox.test_branch',
46
50
                     'bzrlib.tests.blackbox.test_break_lock',
 
51
                     'bzrlib.tests.blackbox.test_breakin',
47
52
                     'bzrlib.tests.blackbox.test_bound_branches',
48
53
                     'bzrlib.tests.blackbox.test_bundle',
49
54
                     'bzrlib.tests.blackbox.test_cat',
 
55
                     'bzrlib.tests.blackbox.test_cat_revision',
50
56
                     'bzrlib.tests.blackbox.test_checkout',
51
57
                     'bzrlib.tests.blackbox.test_command_encoding',
52
58
                     'bzrlib.tests.blackbox.test_commit',
53
59
                     'bzrlib.tests.blackbox.test_conflicts',
 
60
                     'bzrlib.tests.blackbox.test_debug',
54
61
                     'bzrlib.tests.blackbox.test_diff',
55
62
                     'bzrlib.tests.blackbox.test_exceptions',
56
63
                     'bzrlib.tests.blackbox.test_export',
61
68
                     'bzrlib.tests.blackbox.test_info',
62
69
                     'bzrlib.tests.blackbox.test_init',
63
70
                     'bzrlib.tests.blackbox.test_inventory',
 
71
                     'bzrlib.tests.blackbox.test_join',
64
72
                     'bzrlib.tests.blackbox.test_locale',
65
73
                     'bzrlib.tests.blackbox.test_log',
66
74
                     'bzrlib.tests.blackbox.test_logformats',
67
75
                     'bzrlib.tests.blackbox.test_ls',
 
76
                     'bzrlib.tests.blackbox.test_lsprof',
68
77
                     'bzrlib.tests.blackbox.test_merge',
 
78
                     'bzrlib.tests.blackbox.test_merge_directive',
69
79
                     'bzrlib.tests.blackbox.test_missing',
70
80
                     'bzrlib.tests.blackbox.test_mv',
 
81
                     'bzrlib.tests.blackbox.test_nick',
71
82
                     'bzrlib.tests.blackbox.test_outside_wt',
72
83
                     'bzrlib.tests.blackbox.test_pull',
73
84
                     'bzrlib.tests.blackbox.test_push',
75
86
                     'bzrlib.tests.blackbox.test_remerge',
76
87
                     'bzrlib.tests.blackbox.test_remove',
77
88
                     'bzrlib.tests.blackbox.test_re_sign',
 
89
                     'bzrlib.tests.blackbox.test_remove_tree',
78
90
                     'bzrlib.tests.blackbox.test_revert',
79
91
                     'bzrlib.tests.blackbox.test_revno',
80
92
                     'bzrlib.tests.blackbox.test_revision_history',
83
95
                     'bzrlib.tests.blackbox.test_serve',
84
96
                     'bzrlib.tests.blackbox.test_shared_repository',
85
97
                     'bzrlib.tests.blackbox.test_sign_my_commits',
 
98
                     'bzrlib.tests.blackbox.test_split',
86
99
                     'bzrlib.tests.blackbox.test_status',
 
100
                     'bzrlib.tests.blackbox.test_tags',
87
101
                     'bzrlib.tests.blackbox.test_testament',
88
102
                     'bzrlib.tests.blackbox.test_too_much',
89
103
                     'bzrlib.tests.blackbox.test_uncommit',
90
104
                     'bzrlib.tests.blackbox.test_update',
91
105
                     'bzrlib.tests.blackbox.test_upgrade',
 
106
                     'bzrlib.tests.blackbox.test_version',
92
107
                     'bzrlib.tests.blackbox.test_version_info',
93
108
                     'bzrlib.tests.blackbox.test_versioning',
94
109
                     'bzrlib.tests.blackbox.test_whoami',
108
123
 
109
124
class ExternalBase(TestCaseWithTransport):
110
125
 
111
 
    def runbzr(self, args, retcode=0, backtick=False):
 
126
    @deprecated_method(zero_eighteen)
 
127
    def runbzr(self, args, retcode=0):
112
128
        if isinstance(args, basestring):
113
129
            args = args.split()
114
 
        if backtick:
115
 
            return self.run_bzr_captured(args, retcode=retcode)[0]
116
 
        else:
117
 
            return self.run_bzr_captured(args, retcode=retcode)
118
 
 
119
 
 
120
 
class TestUIFactory(ui.CLIUIFactory):
121
 
    """A UI Factory for testing - hide the progress bar but emit note()s."""
122
 
 
123
 
    def __init__(self,
124
 
                 stdout=None,
125
 
                 stderr=None):
126
 
        super(TestUIFactory, self).__init__()
127
 
        if stdout is None:
128
 
            self.stdout = sys.stdout
129
 
        else:
130
 
            self.stdout = stdout
131
 
        if stderr is None:
132
 
            self.stderr = sys.stderr
133
 
        else:
134
 
            self.stderr = stderr
135
 
 
136
 
    def clear(self):
137
 
        """See progress.ProgressBar.clear()."""
138
 
 
139
 
    def clear_term(self):
140
 
        """See progress.ProgressBar.clear_term()."""
141
 
 
142
 
    def clear_term(self):
143
 
        """See progress.ProgressBar.clear_term()."""
144
 
 
145
 
    def finished(self):
146
 
        """See progress.ProgressBar.finished()."""
147
 
 
148
 
    def note(self, fmt_string, *args, **kwargs):
149
 
        """See progress.ProgressBar.note()."""
150
 
        self.stdout.write((fmt_string + "\n") % args)
151
 
 
152
 
    def progress_bar(self):
153
 
        return self
154
 
    
155
 
    def nested_progress_bar(self):
156
 
        return self
157
 
 
158
 
    def update(self, message, count=None, total=None):
159
 
        """See progress.ProgressBar.update()."""
 
130
        return self.run_bzr(args, retcode=retcode)
 
131
 
 
132
    def check_output(self, output, *args):
 
133
        """Verify that the expected output matches what bzr says.
 
134
 
 
135
        The output is supplied first, so that you can supply a variable
 
136
        number of arguments to bzr.
 
137
        """
 
138
        self.assertEquals(self.run_bzr(*args)[0], output)