~bzr-pqm/bzr/bzr.dev

3948.2.6 by Martin Pool
ProgressBarStack is deprecated
1
# Copyright (C) 2006, 2007, 2009 Canonical Ltd
1551.2.27 by Aaron Bentley
Got propogation under test
2
#
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
4183.7.1 by Sabin Iacob
update FSF mailing address
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1551.2.27 by Aaron Bentley
Got propogation under test
16
1843.3.5 by John Arbash Meinel
Add tests to assert we fall back to DotsProgressBar when appropriate.
17
import os
1551.2.28 by Aaron Bentley
Ensure all ProgressBar implementations can be used as parents
18
from StringIO import StringIO
19
1843.3.7 by John Arbash Meinel
new env var 'BZR_PROGRESS_BAR' to select the exact progress type
20
from bzrlib import errors
1551.2.27 by Aaron Bentley
Got propogation under test
21
from bzrlib.tests import TestCase
3948.2.6 by Martin Pool
ProgressBarStack is deprecated
22
from bzrlib.symbol_versioning import (
23
    deprecated_in,
24
    )
1551.2.27 by Aaron Bentley
Got propogation under test
25
1843.3.7 by John Arbash Meinel
new env var 'BZR_PROGRESS_BAR' to select the exact progress type
26
1843.3.6 by John Arbash Meinel
Cleanup tests by using a helper
27
class _TTYStringIO(StringIO):
28
    """A helper class which makes a StringIO look like a terminal"""
29
30
    def isatty(self):
31
        return True
32
33
34
class _NonTTYStringIO(StringIO):
35
    """Helper that implements isatty() but returns False"""
36
37
    def isatty(self):
38
        return False