mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-03 17:30:25 +01:00
[tests] Move stop_node and start_node methods to BitcoinTestFramework
This commit moves functions start_node, start_nodes, stop_node and stop_nodes functions into the BitcoinTestFramework class. It also moves the bitcoind_processes dict and coverage variables into BitcoinTestFramework.
This commit is contained in:
@@ -21,15 +21,13 @@ from decimal import Decimal
|
||||
import http.client
|
||||
import subprocess
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.test_framework import (BitcoinTestFramework, BITCOIND_PROC_WAIT_TIMEOUT)
|
||||
from test_framework.util import (
|
||||
assert_equal,
|
||||
assert_raises,
|
||||
assert_raises_jsonrpc,
|
||||
assert_is_hex_string,
|
||||
assert_is_hash_string,
|
||||
bitcoind_processes,
|
||||
BITCOIND_PROC_WAIT_TIMEOUT,
|
||||
)
|
||||
|
||||
|
||||
@@ -141,13 +139,13 @@ class BlockchainTest(BitcoinTestFramework):
|
||||
self.nodes[0].generate(6)
|
||||
assert_equal(self.nodes[0].getblockcount(), 206)
|
||||
self.log.debug('Node should not stop at this height')
|
||||
assert_raises(subprocess.TimeoutExpired, lambda: bitcoind_processes[0].wait(timeout=3))
|
||||
assert_raises(subprocess.TimeoutExpired, lambda: self.bitcoind_processes[0].wait(timeout=3))
|
||||
try:
|
||||
self.nodes[0].generate(1)
|
||||
except (ConnectionError, http.client.BadStatusLine):
|
||||
pass # The node already shut down before response
|
||||
self.log.debug('Node should stop at this height...')
|
||||
bitcoind_processes[0].wait(timeout=BITCOIND_PROC_WAIT_TIMEOUT)
|
||||
self.bitcoind_processes[0].wait(timeout=BITCOIND_PROC_WAIT_TIMEOUT)
|
||||
self.nodes[0] = self.start_node(0, self.options.tmpdir)
|
||||
assert_equal(self.nodes[0].getblockcount(), 207)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user