Skip to content

Commit d841301

Browse files
committed
test: Add docstring to wait_until() in util.py to warn about its usage
1 parent 1343c86 commit d841301

File tree

1 file changed

+8
-0
lines changed
  • test/functional/test_framework

1 file changed

+8
-0
lines changed

test/functional/test_framework/util.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,14 @@ def satoshi_round(amount):
226226

227227

228228
def wait_until(predicate, *, attempts=float('inf'), timeout=float('inf'), lock=None, timeout_factor=1.0):
229+
"""Sleep until the predicate resolves to be True.
230+
231+
Warning: Note that this method is not recommended to be used in tests as it is
232+
not aware of the context of the test framework. Using `wait_until()` counterpart
233+
from `BitcoinTestFramework` or `P2PInterface` class ensures an understandable
234+
amount of timeout and a common shared timeout_factor. Furthermore, `wait_until()`
235+
from `P2PInterface` class in `mininode.py` has a preset lock.
236+
"""
229237
if attempts == float('inf') and timeout == float('inf'):
230238
timeout = 60
231239
timeout = timeout * timeout_factor

0 commit comments

Comments
 (0)