示例#1
0
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 == ''
示例#2
0
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
示例#3
0
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 == ''