Rev 4752: More precise test. in file:///home/vila/src/bzr/bugs/353370-notty-no-term-width/

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri Oct 23 13:57:16 BST 2009


At file:///home/vila/src/bzr/bugs/353370-notty-no-term-width/

------------------------------------------------------------
revno: 4752
revision-id: v.ladeuil+lp at free.fr-20091023125716-93f2al97p0e2kayj
parent: v.ladeuil+lp at free.fr-20091023104115-ytq42i3b420x6j5x
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 353370-notty-no-term-width
timestamp: Fri 2009-10-23 14:57:16 +0200
message:
  More precise test.
  
  * bzrlib/tests/test_osutils.py:
  (TestTerminalWidth.test_tty_default_without_columns): stdout is
  not a tty under some babune hosts.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_osutils.py'
--- a/bzrlib/tests/test_osutils.py	2009-10-23 10:41:15 +0000
+++ b/bzrlib/tests/test_osutils.py	2009-10-23 12:57:16 +0000
@@ -1897,6 +1897,16 @@
 
     def test_tty_default_without_columns(self):
         del os.environ['COLUMNS']
+        orig_stdout = sys.stdout
+        def restore():
+            sys.stdout = orig_stdout
+        self.addCleanup(restore)
+
+        class I_am_a_tty(object):
+            def isatty(self):
+                return True
+
+        sys.stdout = I_am_a_tty()
         self.assertEquals(osutils.default_tty_width, osutils.terminal_width())
 
     def test_non_tty_default_without_columns(self):



More information about the bazaar-commits mailing list