add function waiting for incoming message
authorVolker Birk <vb@pep.foundation>
Thu, 04 Jan 2018 22:44:26 +0100
changeset 234913085d58b256
parent 2348 56c8623b7fa3
child 2350 4725d91aabeb
add function waiting for incoming message
test/python_tests/transport.py
     1.1 --- a/test/python_tests/transport.py	Thu Jan 04 22:19:13 2018 +0100
     1.2 +++ b/test/python_tests/transport.py	Thu Jan 04 22:44:26 2018 +0100
     1.3 @@ -46,3 +46,17 @@
     1.4  
     1.5      return msg
     1.6  
     1.7 +
     1.8 +def wait_for_message():
     1.9 +    "wait until a message arrives and return the message"
    1.10 +
    1.11 +    while True:
    1.12 +        try:
    1.13 +            msg = recv_message()
    1.14 +        except IndexError:
    1.15 +            time.sleep(1)
    1.16 +        else:
    1.17 +            break
    1.18 +
    1.19 +    return msg
    1.20 +