aboutsummaryrefslogtreecommitdiff
path: root/test/functional/example_test.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2017-08-23 17:11:33 -0400
committerMarcoFalke <falke.marco@gmail.com>2017-08-23 17:12:30 -0400
commit8858b6ddd3bce9daa08da6e05de3ca863a399c15 (patch)
treeeeb5f3af4845e8815d800d64f225784b40015abb /test/functional/example_test.py
parent41496e20f36987d27bed6cb83c06a6a978bfdf42 (diff)
parent08ce33f8e95efa81b37ddc6b3350462c61bbfd51 (diff)
downloadbitcoin-8858b6ddd3bce9daa08da6e05de3ca863a399c15.tar.xz
Merge #11068: qa: Move wait_until to util
08ce33f8e qa: Move wait_until to util (MarcoFalke) Pull request description: This moves `wait_until` to `util.py` to make it generally available to python tests. Also, `wait_until` now takes an optional lock that is acquired while testing the predicate. Previously the lock was always acquired, even when it was not necessary, cf. `disconnect_ban.py`. Tree-SHA512: 18e452a017a6566fa8ad09bde058e1b841e167039dc63299e70cfa7a6dcbc779581e60ca3e8eb2f1b610767d5208b9376c203eb11015b250fd0542b5eb4215a8
Diffstat (limited to 'test/functional/example_test.py')
-rwxr-xr-xtest/functional/example_test.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/functional/example_test.py b/test/functional/example_test.py
index 79940a4264..4f9e0a7dd2 100755
--- a/test/functional/example_test.py
+++ b/test/functional/example_test.py
@@ -23,13 +23,13 @@ from test_framework.mininode import (
mininode_lock,
msg_block,
msg_getdata,
- wait_until,
)
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
connect_nodes,
p2p_port,
+ wait_until,
)
# NodeConnCB is a class containing callbacks to be executed when a P2P
@@ -209,7 +209,7 @@ class ExampleTest(BitcoinTestFramework):
# wait_until() will loop until a predicate condition is met. Use it to test properties of the
# NodeConnCB objects.
- assert wait_until(lambda: sorted(blocks) == sorted(list(node2.block_receive_map.keys())), timeout=5)
+ wait_until(lambda: sorted(blocks) == sorted(list(node2.block_receive_map.keys())), timeout=5, lock=mininode_lock)
self.log.info("Check that each block was received only once")
# The network thread uses a global lock on data access to the NodeConn objects when sending and receiving