test: Format predicate source as multiline on error
This commit is contained in:
parent
fa1dce7329
commit
fa3872e7b4
1 changed files with 1 additions and 1 deletions
|
@ -216,7 +216,7 @@ def wait_until(predicate, *, attempts=float('inf'), timeout=float('inf'), lock=N
|
||||||
time.sleep(0.05)
|
time.sleep(0.05)
|
||||||
|
|
||||||
# Print the cause of the timeout
|
# Print the cause of the timeout
|
||||||
predicate_source = inspect.getsourcelines(predicate)
|
predicate_source = "''''\n" + inspect.getsource(predicate) + "'''"
|
||||||
logger.error("wait_until() failed. Predicate: {}".format(predicate_source))
|
logger.error("wait_until() failed. Predicate: {}".format(predicate_source))
|
||||||
if attempt >= attempts:
|
if attempt >= attempts:
|
||||||
raise AssertionError("Predicate {} not true after {} attempts".format(predicate_source, attempts))
|
raise AssertionError("Predicate {} not true after {} attempts".format(predicate_source, attempts))
|
||||||
|
|
Loading…
Reference in a new issue