Skip to content

Commit 1ff1c34

Browse files
fjahrMarcoFalke
andcommitted
test: Rename wait_until_helper to wait_until_helper_internal
Co-authored-by: MarcoFalke <falke.marco@gmail.com>
1 parent a482f86 commit 1ff1c34

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

test/functional/test_framework/p2p.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
from test_framework.util import (
7878
MAX_NODES,
7979
p2p_port,
80-
wait_until_helper,
80+
wait_until_helper_internal,
8181
)
8282

8383
logger = logging.getLogger("TestFramework.p2p")
@@ -466,7 +466,7 @@ def test_function():
466466
assert self.is_connected
467467
return test_function_in()
468468

469-
wait_until_helper(test_function, timeout=timeout, lock=p2p_lock, timeout_factor=self.timeout_factor)
469+
wait_until_helper_internal(test_function, timeout=timeout, lock=p2p_lock, timeout_factor=self.timeout_factor)
470470

471471
def wait_for_connect(self, timeout=60):
472472
test_function = lambda: self.is_connected
@@ -602,7 +602,7 @@ def run(self):
602602
def close(self, timeout=10):
603603
"""Close the connections and network event loop."""
604604
self.network_event_loop.call_soon_threadsafe(self.network_event_loop.stop)
605-
wait_until_helper(lambda: not self.network_event_loop.is_running(), timeout=timeout)
605+
wait_until_helper_internal(lambda: not self.network_event_loop.is_running(), timeout=timeout)
606606
self.network_event_loop.close()
607607
self.join(timeout)
608608
# Safe to remove event loop.

test/functional/test_framework/test_framework.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
get_datadir_path,
3434
initialize_datadir,
3535
p2p_port,
36-
wait_until_helper,
36+
wait_until_helper_internal,
3737
)
3838

3939

@@ -747,7 +747,7 @@ def sync_all(self, nodes=None):
747747
self.sync_mempools(nodes)
748748

749749
def wait_until(self, test_function, timeout=60):
750-
return wait_until_helper(test_function, timeout=timeout, timeout_factor=self.options.timeout_factor)
750+
return wait_until_helper_internal(test_function, timeout=timeout, timeout_factor=self.options.timeout_factor)
751751

752752
# Private helper methods. These should not be accessed by the subclass test scripts.
753753

test/functional/test_framework/test_node.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
get_auth_cookie,
3737
get_rpc_proxy,
3838
rpc_url,
39-
wait_until_helper,
39+
wait_until_helper_internal,
4040
p2p_port,
4141
)
4242

@@ -253,7 +253,7 @@ def wait_for_rpc_connection(self):
253253
if self.version_is_at_least(190000):
254254
# getmempoolinfo.loaded is available since commit
255255
# bb8ae2c (version 0.19.0)
256-
wait_until_helper(lambda: rpc.getmempoolinfo()['loaded'], timeout_factor=self.timeout_factor)
256+
wait_until_helper_internal(lambda: rpc.getmempoolinfo()['loaded'], timeout_factor=self.timeout_factor)
257257
# Wait for the node to finish reindex, block import, and
258258
# loading the mempool. Usually importing happens fast or
259259
# even "immediate" when the node is started. However, there
@@ -407,7 +407,7 @@ def is_node_stopped(self, *, expected_stderr="", expected_ret_code=0):
407407

408408
def wait_until_stopped(self, *, timeout=BITCOIND_PROC_WAIT_TIMEOUT, expect_error=False, **kwargs):
409409
expected_ret_code = 1 if expect_error else 0 # Whether node shutdown return EXIT_FAILURE or EXIT_SUCCESS
410-
wait_until_helper(lambda: self.is_node_stopped(expected_ret_code=expected_ret_code, **kwargs), timeout=timeout, timeout_factor=self.timeout_factor)
410+
wait_until_helper_internal(lambda: self.is_node_stopped(expected_ret_code=expected_ret_code, **kwargs), timeout=timeout, timeout_factor=self.timeout_factor)
411411

412412
def replace_in_config(self, replacements):
413413
"""
@@ -718,7 +718,7 @@ def disconnect_p2ps(self):
718718
p.peer_disconnect()
719719
del self.p2ps[:]
720720

721-
wait_until_helper(lambda: self.num_test_p2p_connections() == 0, timeout_factor=self.timeout_factor)
721+
wait_until_helper_internal(lambda: self.num_test_p2p_connections() == 0, timeout_factor=self.timeout_factor)
722722

723723
def bumpmocktime(self, seconds):
724724
"""Fast forward using setmocktime to self.mocktime + seconds. Requires setmocktime to have

test/functional/test_framework/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def satoshi_round(amount):
241241
return Decimal(amount).quantize(Decimal('0.00000001'), rounding=ROUND_DOWN)
242242

243243

244-
def wait_until_helper(predicate, *, attempts=float('inf'), timeout=float('inf'), lock=None, timeout_factor=1.0):
244+
def wait_until_helper_internal(predicate, *, attempts=float('inf'), timeout=float('inf'), lock=None, timeout_factor=1.0):
245245
"""Sleep until the predicate resolves to be True.
246246
247247
Warning: Note that this method is not recommended to be used in tests as it is

0 commit comments

Comments
 (0)