~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_progress.py

  • Committer: John Arbash Meinel
  • Date: 2008-08-25 21:50:11 UTC
  • mfrom: (0.11.3 tools)
  • mto: This revision was merged to the branch mainline in revision 3659.
  • Revision ID: john@arbash-meinel.com-20080825215011-de9esmzgkue3e522
Merge in Lukáš's helper scripts.
Update the packaging documents to describe how to do the releases
using bzr-builddeb to package all distro platforms
simultaneously.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
        TTYProgressBar,
25
25
        DotsProgressBar,
26
26
        ProgressBarStack,
 
27
        InstrumentedProgress,
27
28
        )
28
29
from bzrlib.tests import TestCase
29
30
 
30
31
 
31
32
class FakeStack:
 
33
 
32
34
    def __init__(self, top):
33
35
        self.__top = top
34
36
 
35
37
    def top(self):
36
38
        return self.__top
37
39
 
38
 
class InstrumentedProgress(TTYProgressBar):
39
 
    """TTYProgress variant that tracks outcomes"""
40
 
 
41
 
    def __init__(self, *args, **kwargs):
42
 
        self.always_throttled = True
43
 
        TTYProgressBar.__init__(self, *args, **kwargs)
44
 
 
45
 
    def throttle(self, old_message):
46
 
        result = TTYProgressBar.throttle(self, old_message)
47
 
        if result is False:
48
 
            self.always_throttled = False
49
 
        
50
40
 
51
41
class _TTYStringIO(StringIO):
52
42
    """A helper class which makes a StringIO look like a terminal"""
63
53
 
64
54
 
65
55
class TestProgress(TestCase):
 
56
 
66
57
    def setUp(self):
67
58
        q = DummyProgress()
68
59
        self.top = ChildProgress(_stack=FakeStack(q))