/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/blackbox/__init__.py

  • Committer: Wouter van Heyst
  • Date: 2006-06-06 12:06:20 UTC
  • mfrom: (1740 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: larstiq@larstiq.dyndns.org-20060606120620-50066b0951e4ef7c
merge bzr.dev 1740

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
rather starts again from the run_bzr function.
24
24
"""
25
25
 
26
 
from bzrlib.tests.EncodingAdapter import EncodingTestAdapter
 
26
import sys
 
27
 
27
28
from bzrlib.tests import (
28
 
                          _load_module_by_name,
29
29
                          TestCaseWithTransport,
30
30
                          TestSuite,
31
31
                          TestLoader,
32
32
                          iter_suite_tests,
33
33
                          )
 
34
from bzrlib.tests.EncodingAdapter import EncodingTestAdapter
34
35
import bzrlib.ui as ui
35
36
 
36
37
 
37
38
def test_suite():
38
39
    testmod_names = [
 
40
                     'bzrlib.tests.blackbox.test_add',
39
41
                     'bzrlib.tests.blackbox.test_added',
40
42
                     'bzrlib.tests.blackbox.test_aliases',
41
43
                     'bzrlib.tests.blackbox.test_ancestry',
42
44
                     'bzrlib.tests.blackbox.test_annotate',
 
45
                     'bzrlib.tests.blackbox.test_branch',
43
46
                     'bzrlib.tests.blackbox.test_break_lock',
44
47
                     'bzrlib.tests.blackbox.test_bound_branches',
45
48
                     'bzrlib.tests.blackbox.test_cat',
51
54
                     'bzrlib.tests.blackbox.test_export',
52
55
                     'bzrlib.tests.blackbox.test_find_merge_base',
53
56
                     'bzrlib.tests.blackbox.test_help',
 
57
                     'bzrlib.tests.blackbox.test_ignored',
54
58
                     'bzrlib.tests.blackbox.test_info',
55
59
                     'bzrlib.tests.blackbox.test_init',
56
60
                     'bzrlib.tests.blackbox.test_log',
61
65
                     'bzrlib.tests.blackbox.test_pull',
62
66
                     'bzrlib.tests.blackbox.test_push',
63
67
                     'bzrlib.tests.blackbox.test_reconcile',
 
68
                     'bzrlib.tests.blackbox.test_remove',
64
69
                     'bzrlib.tests.blackbox.test_re_sign',
65
70
                     'bzrlib.tests.blackbox.test_revert',
66
71
                     'bzrlib.tests.blackbox.test_revno',
79
84
        'bzrlib.tests.blackbox.test_non_ascii',
80
85
    ]
81
86
 
82
 
    suite = TestSuite()
83
87
    loader = TestLoader()
84
 
    for mod_name in testmod_names:
85
 
        mod = _load_module_by_name(mod_name)
86
 
        suite.addTest(loader.loadTestsFromModule(mod))
 
88
    suite = loader.loadTestsFromModuleNames(testmod_names) 
87
89
 
88
90
    adapter = EncodingTestAdapter()
89
91
    for mod_name in test_encodings:
105
107
            return self.run_bzr_captured(args, retcode=retcode)
106
108
 
107
109
 
108
 
class TestUIFactory(ui.UIFactory):
 
110
class TestUIFactory(ui.CLIUIFactory):
109
111
    """A UI Factory for testing - hide the progress bar but emit note()s."""
110
112
 
 
113
    def __init__(self,
 
114
                 stdout=None,
 
115
                 stderr=None):
 
116
        super(TestUIFactory, self).__init__()
 
117
        if stdout is None:
 
118
            self.stdout = sys.stdout
 
119
        else:
 
120
            self.stdout = stdout
 
121
        if stderr is None:
 
122
            self.stderr = sys.stderr
 
123
        else:
 
124
            self.stderr = stderr
 
125
 
111
126
    def clear(self):
112
127
        """See progress.ProgressBar.clear()."""
113
128
 
 
129
    def clear_term(self):
 
130
        """See progress.ProgressBar.clear_term()."""
 
131
 
 
132
    def clear_term(self):
 
133
        """See progress.ProgressBar.clear_term()."""
 
134
 
114
135
    def finished(self):
115
136
        """See progress.ProgressBar.finished()."""
116
137
 
117
138
    def note(self, fmt_string, *args, **kwargs):
118
139
        """See progress.ProgressBar.note()."""
119
 
        print fmt_string % args
 
140
        self.stdout.write((fmt_string + "\n") % args)
120
141
 
121
142
    def progress_bar(self):
122
143
        return self