Skip to content

Commit

Permalink
fixing ttyTest on travis appears hopeless...
Browse files Browse the repository at this point in the history
  • Loading branch information
knipknap committed Mar 27, 2017
1 parent b2dc10a commit 472e981
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions tests/Exscript/util/ttyTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,28 @@ def testGetTerminalSize(self):
self.assertEqual(get_terminal_size(10, 10), (10, 10))

# If the LINES and COLUMNS variables are set, they should be used.
os.environ['LINES'] = '1000'
os.environ['COLUMNS'] = '1000'
self.assertEqual(get_terminal_size(), (1000, 1000))
self.assertEqual(get_terminal_size(10, 10), (1000, 1000))
os.environ['LINES'] = '1111'
os.environ['COLUMNS'] = '1111'
self.assertEqual(get_terminal_size(), (1111, 1111))
self.assertEqual(get_terminal_size(10, 10), (1111, 1111))

# If the stty program exists, it should be used.
os.environ['PATH'] = oldpath
try:
with Popen(['stty', 'size'], stdout=PIPE, stderr=PIPE):
self.assertNotEqual(get_terminal_size(), (1000, 1000))
self.assertNotEqual(get_terminal_size(10, 10), (1000, 1000))
# Unfortunately, the 'stty' program on travis actually returns
# (1111, 1111) if the LINES and COLUMNS env variables are set,
# so there is no way to tests whether stty was used or the env
# vars.
#self.assertNotEqual(get_terminal_size(), (1111, 1111))
self.assertNotEqual(get_terminal_size(10, 10), (25, 80))
except OSError:
pass # "stty" not found.

# Lastly, if stdin/stderr/stdout exist, they should tell us something.
os.environ['PATH'] = ''
self._unredirect()
self.assertNotEqual(get_terminal_size(), (1000, 1000))
self.assertNotEqual(get_terminal_size(10, 10), (1000, 1000))
self.assertNotEqual(get_terminal_size(), (1111, 1111))
self.assertNotEqual(get_terminal_size(10, 10), (1111, 1111))
os.environ['PATH'] = oldpath


Expand Down

0 comments on commit 472e981

Please sign in to comment.