Ejemplo n.º 1
0
 def defaults_to_80x24_when_stdout_not_a_tty(self, ioctl, stdout):
     # Make sure stdout acts like a real stream (means failure is
     # more obvious)
     stdout.fileno.return_value = 1
     # Ensure it fails the isatty() test too
     stdout.isatty.return_value = False
     # Test
     eq_(pty_size(), (80, 24))
Ejemplo n.º 2
0
 def defaults_to_80x24_when_stdout_not_a_tty(self, ioctl, stdout):
     # Make sure stdout acts like a real stream (means failure is
     # more obvious)
     stdout.fileno.return_value = 1
     # Ensure it fails the isatty() test too
     stdout.isatty.return_value = False
     # Test
     eq_(pty_size(), (80, 24))
Ejemplo n.º 3
0
 def uses_default_when_stdout_triggers_ioctl_error(
     self, ioctl, stdout
 ):
     ioctl.side_effect = TypeError
     eq_(pty_size(), (80, 24))
Ejemplo n.º 4
0
 def uses_default_when_stdout_lacks_fileno(self, ioctl, stdout):
     # i.e. when accessing it throws AttributeError
     stdout.fileno.side_effect = AttributeError
     eq_(pty_size(), (80, 24))
Ejemplo n.º 5
0
 def calls_fcntl_with_TIOCGWINSZ(self, ioctl):
     # Test the default (Unix) implementation because that's all we
     # can realistically do here.
     pty_size()
     eq_(ioctl.call_args_list[0][0][1], termios.TIOCGWINSZ)
Ejemplo n.º 6
0
 def uses_default_when_stdout_lacks_fileno(self, ioctl, stdout):
     # i.e. when accessing it throws AttributeError
     stdout.fileno.side_effect = AttributeError
     eq_(pty_size(), (80, 24))
     # Make sure we skipped over ioctl
     assert not ioctl.called
Ejemplo n.º 7
0
 def calls_fcntl_with_TIOCGWINSZ(self, ioctl):
     # Test the default (Unix) implementation because that's all we
     # can realistically do here.
     pty_size()
     eq_(ioctl.call_args_list[0][0][1], termios.TIOCGWINSZ)
Ejemplo n.º 8
0
 def uses_default_when_stdout_triggers_ioctl_error(
         self, ioctl, stdout):
     ioctl.side_effect = TypeError
     eq_(pty_size(), (80, 24))
Ejemplo n.º 9
0
 def uses_default_when_stdout_lacks_fileno(self, ioctl, stdout):
     # i.e. when accessing it throws AttributeError
     stdout.fileno.side_effect = AttributeError
     eq_(pty_size(), (80, 24))