18
18
from StringIO import StringIO
20
from bzrlib import errors
20
21
from bzrlib.progress import (
21
22
DummyProgress, ChildProgress,
275
277
pb = self.get_nested(out, 'dumb')
277
279
self.assertIsInstance(pb, DotsProgressBar)
281
def test_progress_env_tty(self):
282
# The environ variable BZR_PROGRESS_BAR controls what type of
283
# progress bar we will get, even if it wouldn't usually be that type
286
# Usually, this would be a DotsProgressBar
287
out = cStringIO.StringIO()
288
pb = self.get_nested(out, 'dumb', 'tty')
290
# Even though we are not a tty, the env_var will override
291
self.assertIsInstance(pb, TTYProgressBar)
293
def test_progress_env_dots(self):
294
# Even though we are in a tty, the env_var will override
296
pb = self.get_nested(out, 'xterm', 'dots')
298
self.assertIsInstance(pb, DotsProgressBar)
300
def test_progress_env_none(self):
301
# Even though we are in a valid tty, no progress
303
pb = self.get_nested(out, 'xterm', 'none')
305
self.assertIsInstance(pb, DummyProgress)
307
def test_progress_env_invalid(self):
309
self.assertRaises(errors.InvalidProgressBarType, self.get_nested,
310
out, 'xterm', 'nonexistant')