~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/testsupport.py

  • Committer: Martin Pool
  • Date: 2010-09-14 04:34:28 UTC
  • mto: This revision was merged to the branch mainline in revision 5423.
  • Revision ID: mbp@sourcefrog.net-20100914043428-u998x9pqxk3x28t6
Delete CapturingUIFactory methods that can inherit from DummyProgress

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
 
21
21
from bzrlib import (
 
22
    progress,
22
23
    ui,
23
24
    )
24
25
 
25
26
 
26
 
class CapturingUIFactory(ui.UIFactory):
27
 
    """A UI Factory for testing - capture the updates made through it."""
 
27
class CapturingUIFactory(ui.UIFactory, progress.DummyProgress):
 
28
    """Captures progress updates made through it.
 
29
    
 
30
    This is overloaded as both the UIFactory and the progress model."""
28
31
 
29
32
    def __init__(self):
30
33
        super(CapturingUIFactory, self).__init__()
31
34
        self._calls = []
32
35
        self.depth = 0
33
36
 
34
 
    def clear(self):
35
 
        """See progress.ProgressTask.clear()."""
36
 
 
37
 
    def clear_term(self):
38
 
        """See progress.ProgressTask.clear_term()."""
 
37
    def nested_progress_bar(self):
 
38
        self.depth += 1
 
39
        return self
39
40
 
40
41
    def finished(self):
41
 
        """See progress.ProgressTask.finished()."""
42
42
        self.depth -= 1
43
43
 
44
 
    def note(self, fmt_string, *args, **kwargs):
45
 
        """See progress.ProgressTask.note()."""
46
 
 
47
 
    def progress_bar(self):
48
 
        return self
49
 
 
50
 
    def nested_progress_bar(self):
51
 
        self.depth += 1
52
 
        return self
53
 
 
54
44
    def update(self, message, count=None, total=None):
55
 
        """See progress.ProgressTask.update()."""
56
45
        if self.depth == 1:
57
46
            self._calls.append(("update", count, total, message))
58
 
 
59