/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/test_progress.py

Merge bzr.dev, resolve conflicts.

Check failing tests:

- bug #225020 is back under a different ugly head. But I don't think it's
  worth working around it *again* given that: it's a bug in curl and
  fixed there (in 7.19, still need checking for 7.18.2 available in
  intrepid), occurs only in the test suite and only with
  python-2.7.0alpha0, I need a true python-2.6 (wip).

- more problematic are the thread leaks, it seems that python-2.6 refuse
  to spawn more than 256 and the whole test suite hits that
  limit. Re-running failing tests with --starting-with succeeds.

- some test_read_bundle tests fail with a curl connection error (server
  certificate verification failed) but they use the wrong CAfile (need
  investigaton, most probably a wrong setUp, we need to use a CAfile that
  knows about the test server).

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))