Skip to content

Commit 5bf5f3b

Browse files
committed
pytest: print useful information if we don't get our channelmoves/chainmoves
The equality check will fail, but it will show is what is missing, rather than: FAILED tests/test_coinmoves.py::test_coinmoves_unilateral_htlc_fulfill - ValueError: Timeout while waiting for <function check_chain_moves.<locals>.<lambda> at 0x7f7800941ab0> Signed-off-by: Rusty Russell <[email protected]>
1 parent e0c60cf commit 5bf5f3b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/test_coinmoves.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,21 @@ def check_moves(moves, expected):
3737

3838

3939
def check_channel_moves(node, expected):
40-
wait_for(lambda: len(node.rpc.listchannelmoves()['channelmoves']) == len(expected))
40+
# If this times out, show the result anyway.
41+
try:
42+
wait_for(lambda: len(node.rpc.listchannelmoves()['channelmoves']) == len(expected))
43+
except ValueError:
44+
print("*** Didn't see enough channelmoves")
4145
check_moves(node.rpc.listchannelmoves()['channelmoves'], expected)
4246
check_sql(node, "channelmoves", expected)
4347

4448

4549
def check_chain_moves(node, expected):
46-
wait_for(lambda: len(node.rpc.listchainmoves()['chainmoves']) == len(expected))
50+
# If this times out, show the result anyway.
51+
try:
52+
wait_for(lambda: len(node.rpc.listchainmoves()['chainmoves']) == len(expected))
53+
except ValueError:
54+
print("*** Didn't see enough chainmoves")
4755
check_moves(node.rpc.listchainmoves()['chainmoves'], expected)
4856
check_sql(node, "chainmoves", expected)
4957
# Check extra_tags.

0 commit comments

Comments
 (0)