def child(kind): t = TestTerminal(kind=kind, stream=StringIO()) assert t._init_descriptor == sys.__stdout__.fileno() assert isinstance(t.height, int) assert isinstance(t.width, int) assert t.height == t._height_and_width()[0] assert t.width == t._height_and_width()[1]
def child(kind): t = TestTerminal(kind=kind, stream=StringIO()) assert t._init_descriptor == sys.__stdout__.fileno() assert (isinstance(t.height, int)) assert (isinstance(t.width, int)) assert t.height == t._height_and_width()[0] assert t.width == t._height_and_width()[1]
def child(): def side_effect(fd): raise IOError term = TestTerminal() term._winsize = side_effect os.environ['COLUMNS'] = '1984' os.environ['LINES'] = '1888' assert term._height_and_width() == (1888, 1984, None, None)
def child(): def side_effect(fd): raise IOError term = TestTerminal() term._winsize = side_effect os.environ["COLUMNS"] = "1984" os.environ["LINES"] = "1888" assert term._height_and_width() == (1888, 1984, None, None)
def child(lines=25, cols=80): # set the pty's virtual window size val = struct.pack('HHHH', lines, cols, 0, 0) fcntl.ioctl(sys.__stdout__.fileno(), termios.TIOCSWINSZ, val) t = TestTerminal() winsize = t._height_and_width() assert t.width == cols assert t.height == lines assert winsize.ws_col == cols assert winsize.ws_row == lines
def child(): # set the pty's virtual window size os.environ['COLUMNS'] = '99' os.environ['LINES'] = '11' t = TestTerminal(stream=StringIO()) save_init = t._init_descriptor save_stdout = sys.__stdout__ try: t._init_descriptor = None sys.__stdout__ = None winsize = t._height_and_width() width = t.width height = t.height finally: t._init_descriptor = save_init sys.__stdout__ = save_stdout assert winsize.ws_col == width == 99 assert winsize.ws_row == height == 11