Skip to content

Commit

Permalink
MQTT integration tests: even more forgiving
Browse files Browse the repository at this point in the history
...and clean up exception message
  • Loading branch information
declension committed Jul 24, 2018
1 parent d96234b commit b8e2727
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions squeezealexa/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ def wait_for(func, timeout=3, what=None, context=None):
sleep(0.1)
nt = time()
if nt - t > timeout:
msg = "Timed out {task} in {context}".format(task=what,
context=str(context))
msg = "Failed \"{task}\" in {context}, after {secs:.2f}s".format(
task=what, context=str(context), secs=nt - t)
raise Exception(msg)
print_d("Stats: \"{task}\" took < {duration:.2f} seconds", task=what,
duration=nt - t)
2 changes: 1 addition & 1 deletion tests/transport/mqtt_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def on_publish(client, userdata, mid):
assert replier.loop_start() != MQTT_ERR_INVAL
reply = transport.communicate(msg)
wait_for(lambda x: self.published,
what="confirming publish", timeout=5)
what="confirming publish", timeout=8)
finally:
del transport
replier.loop_stop()
Expand Down

0 comments on commit b8e2727

Please sign in to comment.