mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-20 11:49:07 +02:00
test: Add check_interval parameter to wait_until
This also replaces two sleep calls in functional tests with wait_until
This commit is contained in:
@@ -579,13 +579,13 @@ class P2PInterface(P2PConnection):
|
||||
|
||||
# Connection helper methods
|
||||
|
||||
def wait_until(self, test_function_in, *, timeout=60, check_connected=True):
|
||||
def wait_until(self, test_function_in, *, timeout=60, check_connected=True, check_interval=0.05):
|
||||
def test_function():
|
||||
if check_connected:
|
||||
assert self.is_connected
|
||||
return test_function_in()
|
||||
|
||||
wait_until_helper_internal(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, check_interval=check_interval)
|
||||
|
||||
def wait_for_connect(self, *, timeout=60):
|
||||
test_function = lambda: self.is_connected
|
||||
|
||||
Reference in New Issue
Block a user