aboutsummaryrefslogtreecommitdiff
path: root/test/functional/rpc_net.py
diff options
context:
space:
mode:
authorBen Woosley <ben.woosley@gmail.com>2018-02-26 14:04:41 -0800
committerBen Woosley <ben.woosley@gmail.com>2018-03-15 23:43:53 -0700
commit81b0822772169cb697b5994f49398e619d61a12d (patch)
tree5fa33497ba61f9ab4f14be747aed72225149966d /test/functional/rpc_net.py
parent7be9a9a570c1140048f8781ced1111e1d930e517 (diff)
downloadbitcoin-81b0822772169cb697b5994f49398e619d61a12d.tar.xz
test: Use wait_until in tests where time was used for polling
Diffstat (limited to 'test/functional/rpc_net.py')
-rwxr-xr-xtest/functional/rpc_net.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/test/functional/rpc_net.py b/test/functional/rpc_net.py
index 5f34b35bfb..d8348432aa 100755
--- a/test/functional/rpc_net.py
+++ b/test/functional/rpc_net.py
@@ -7,8 +7,6 @@
Tests correspond to code in rpc/net.cpp.
"""
-import time
-
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
@@ -62,12 +60,8 @@ class NetTest(BitcoinTestFramework):
self.nodes[0].setnetworkactive(False)
assert_equal(self.nodes[0].getnetworkinfo()['networkactive'], False)
- timeout = 3
- while self.nodes[0].getnetworkinfo()['connections'] != 0:
- # Wait a bit for all sockets to close
- assert timeout > 0, 'not all connections closed in time'
- timeout -= 0.1
- time.sleep(0.1)
+ # Wait a bit for all sockets to close
+ wait_until(lambda: self.nodes[0].getnetworkinfo()['connections'] == 0, timeout=3)
self.nodes[0].setnetworkactive(True)
connect_nodes_bi(self.nodes, 0, 1)