def test_PexpectEngine_read_all_can_preserve_buffer(pty_pair): received = 'abcdef' engine = PexpectEngine() engine.open(console_fd=pty_pair.main.fd) pty_pair.secondary.write(received) received1_actual = engine.read_all(preserve_read_buffer=True) received2_actual = engine.read_all() received3_actual = engine.read_all() assert received1_actual == received assert received2_actual == received assert received3_actual == ''
def test_PexpectEngine_read_all_reads_from_console(pty_pair): received = 'abcdef' engine = PexpectEngine() engine.open(console_fd=pty_pair.main.fd) pty_pair.secondary.write(received) received_actual = engine.read_all() assert received_actual == received
def test_PexpectEngine_read_all_returns_received_only_once(pty_pair): received = 'abcdef' engine = PexpectEngine() engine.open(console_fd=pty_pair.main.fd) pty_pair.secondary.write(received) received1_actual = engine.read_all() received2_actual = engine.read_all() assert received1_actual == received assert received2_actual == ''