580
580
self.assertEqual([('source/lnk', 'target/lnk')], processed_links)
583
class TestTerminalEncoding(TestCase):
584
"""Test the auto-detection of proper terminal encoding."""
587
self._stdout = sys.stdout
588
self._stderr = sys.stderr
589
self._stdin = sys.stdin
590
self._user_encoding = bzrlib.user_encoding
592
self.addCleanup(self._reset)
594
sys.stdout = StringIOWrapper()
595
sys.stdout.encoding = 'stdout_encoding'
596
sys.stderr = StringIOWrapper()
597
sys.stderr.encoding = 'stderr_encoding'
598
sys.stdin = StringIOWrapper()
599
sys.stdin.encoding = 'stdin_encoding'
600
bzrlib.user_encoding = 'user_encoding'
603
sys.stdout = self._stdout
604
sys.stderr = self._stderr
605
sys.stdin = self._stdin
606
bzrlib.user_encoding = self._user_encoding
608
def test_get_terminal_encoding(self):
609
# first preference is stdout encoding
610
self.assertEqual('stdout_encoding', osutils.get_terminal_encoding())
612
sys.stdout.encoding = None
613
# if sys.stdout is None, fall back to sys.stdin
614
self.assertEqual('stdin_encoding', osutils.get_terminal_encoding())
616
sys.stdin.encoding = None
617
# and in the worst case, use bzrlib.user_encoding
618
self.assertEqual('user_encoding', osutils.get_terminal_encoding())
583
#class TestTerminalEncoding has been moved to test_osutils_encodings.py
584
# [bialix] 2006/12/26
621
587
class TestSetUnsetEnv(TestCase):