mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 03:47:29 -03:00
test: Rename wait_until_helper to wait_until_helper_internal
Co-authored-by: MarcoFalke <falke.marco@gmail.com>
This commit is contained in:
parent
a482f86779
commit
1ff1c34656
4 changed files with 10 additions and 10 deletions
|
@ -77,7 +77,7 @@ from test_framework.messages import (
|
|||
from test_framework.util import (
|
||||
MAX_NODES,
|
||||
p2p_port,
|
||||
wait_until_helper,
|
||||
wait_until_helper_internal,
|
||||
)
|
||||
|
||||
logger = logging.getLogger("TestFramework.p2p")
|
||||
|
@ -466,7 +466,7 @@ class P2PInterface(P2PConnection):
|
|||
assert self.is_connected
|
||||
return test_function_in()
|
||||
|
||||
wait_until_helper(test_function, timeout=timeout, lock=p2p_lock, timeout_factor=self.timeout_factor)
|
||||
wait_until_helper_internal(test_function, timeout=timeout, lock=p2p_lock, timeout_factor=self.timeout_factor)
|
||||
|
||||
def wait_for_connect(self, timeout=60):
|
||||
test_function = lambda: self.is_connected
|
||||
|
@ -602,7 +602,7 @@ class NetworkThread(threading.Thread):
|
|||
def close(self, timeout=10):
|
||||
"""Close the connections and network event loop."""
|
||||
self.network_event_loop.call_soon_threadsafe(self.network_event_loop.stop)
|
||||
wait_until_helper(lambda: not self.network_event_loop.is_running(), timeout=timeout)
|
||||
wait_until_helper_internal(lambda: not self.network_event_loop.is_running(), timeout=timeout)
|
||||
self.network_event_loop.close()
|
||||
self.join(timeout)
|
||||
# Safe to remove event loop.
|
||||
|
|
|
@ -33,7 +33,7 @@ from .util import (
|
|||
get_datadir_path,
|
||||
initialize_datadir,
|
||||
p2p_port,
|
||||
wait_until_helper,
|
||||
wait_until_helper_internal,
|
||||
)
|
||||
|
||||
|
||||
|
@ -747,7 +747,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||
self.sync_mempools(nodes)
|
||||
|
||||
def wait_until(self, test_function, timeout=60):
|
||||
return wait_until_helper(test_function, timeout=timeout, timeout_factor=self.options.timeout_factor)
|
||||
return wait_until_helper_internal(test_function, timeout=timeout, timeout_factor=self.options.timeout_factor)
|
||||
|
||||
# Private helper methods. These should not be accessed by the subclass test scripts.
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ from .util import (
|
|||
get_auth_cookie,
|
||||
get_rpc_proxy,
|
||||
rpc_url,
|
||||
wait_until_helper,
|
||||
wait_until_helper_internal,
|
||||
p2p_port,
|
||||
)
|
||||
|
||||
|
@ -253,7 +253,7 @@ class TestNode():
|
|||
if self.version_is_at_least(190000):
|
||||
# getmempoolinfo.loaded is available since commit
|
||||
# bb8ae2c (version 0.19.0)
|
||||
wait_until_helper(lambda: rpc.getmempoolinfo()['loaded'], timeout_factor=self.timeout_factor)
|
||||
wait_until_helper_internal(lambda: rpc.getmempoolinfo()['loaded'], timeout_factor=self.timeout_factor)
|
||||
# Wait for the node to finish reindex, block import, and
|
||||
# loading the mempool. Usually importing happens fast or
|
||||
# even "immediate" when the node is started. However, there
|
||||
|
@ -407,7 +407,7 @@ class TestNode():
|
|||
|
||||
def wait_until_stopped(self, *, timeout=BITCOIND_PROC_WAIT_TIMEOUT, expect_error=False, **kwargs):
|
||||
expected_ret_code = 1 if expect_error else 0 # Whether node shutdown return EXIT_FAILURE or EXIT_SUCCESS
|
||||
wait_until_helper(lambda: self.is_node_stopped(expected_ret_code=expected_ret_code, **kwargs), timeout=timeout, timeout_factor=self.timeout_factor)
|
||||
wait_until_helper_internal(lambda: self.is_node_stopped(expected_ret_code=expected_ret_code, **kwargs), timeout=timeout, timeout_factor=self.timeout_factor)
|
||||
|
||||
def replace_in_config(self, replacements):
|
||||
"""
|
||||
|
@ -718,7 +718,7 @@ class TestNode():
|
|||
p.peer_disconnect()
|
||||
del self.p2ps[:]
|
||||
|
||||
wait_until_helper(lambda: self.num_test_p2p_connections() == 0, timeout_factor=self.timeout_factor)
|
||||
wait_until_helper_internal(lambda: self.num_test_p2p_connections() == 0, timeout_factor=self.timeout_factor)
|
||||
|
||||
def bumpmocktime(self, seconds):
|
||||
"""Fast forward using setmocktime to self.mocktime + seconds. Requires setmocktime to have
|
||||
|
|
|
@ -241,7 +241,7 @@ def satoshi_round(amount):
|
|||
return Decimal(amount).quantize(Decimal('0.00000001'), rounding=ROUND_DOWN)
|
||||
|
||||
|
||||
def wait_until_helper(predicate, *, attempts=float('inf'), timeout=float('inf'), lock=None, timeout_factor=1.0):
|
||||
def wait_until_helper_internal(predicate, *, attempts=float('inf'), timeout=float('inf'), lock=None, timeout_factor=1.0):
|
||||
"""Sleep until the predicate resolves to be True.
|
||||
|
||||
Warning: Note that this method is not recommended to be used in tests as it is
|
||||
|
|
Loading…
Reference in a new issue