dimanche 15 avril 2018

Python pexpect: How to avoid timeouts and test c++ CLI program

I'm trying to run tests on a game for a class. Basically trying to determine if the AI always wins or with what degree of confidence it does. I tried using pexpect

    child = pexpect.spawn('./a.out')
    child.expect('Are you player 1 or 2?:')
    child.sendline(player)
    game_play(child)

I defined a separate function for the gameplay but this simple step on getting it launched is timing out. This would definitely not be ideal for say 100 tests. Please assist.

The error code:

    raise TIMEOUT(msg)
pexpect.exceptions.TIMEOUT: Timeout exceeded.
<pexpect.pty_spawn.spawn object at 0x1067638d0>

Aucun commentaire:

Enregistrer un commentaire