Skip to content

nmci.util: support with statement with timeout

Filip Pokryvka requested to merge fp/util_timeout_with into main

Add support for the following code:

with nmci.util.start_timeout(10, "wait for something") as t:
    while t.loop_sleep(0.2):
        if something():
             break

In case something() does not return anything meaningfull in 10s, there will be assert "Timeout 'wait for something' expired in 10.000s".

Edited by Filip Pokryvka

Merge request reports

Loading