Browse Source

Merge pull request #5282

a7af983 don't override dir() in qa rpc tests (Bryan Bishop)
0.10
Wladimir J. van der Laan 10 years ago
parent
commit
09481eec88
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 16
      qa/rpc-tests/util.py

16
qa/rpc-tests/util.py

@ -61,8 +61,8 @@ def sync_mempools(rpc_connections):
bitcoind_processes = {} bitcoind_processes = {}
def initialize_datadir(dir, n): def initialize_datadir(dirname, n):
datadir = os.path.join(dir, "node"+str(n)) datadir = os.path.join(dirname, "node"+str(n))
if not os.path.isdir(datadir): if not os.path.isdir(datadir):
os.makedirs(datadir) os.makedirs(datadir)
with open(os.path.join(datadir, "bitcoin.conf"), 'w') as f: with open(os.path.join(datadir, "bitcoin.conf"), 'w') as f:
@ -145,11 +145,11 @@ def _rpchost_to_args(rpchost):
rv += ['-rpcport=' + rpcport] rv += ['-rpcport=' + rpcport]
return rv return rv
def start_node(i, dir, extra_args=None, rpchost=None): def start_node(i, dirname, extra_args=None, rpchost=None):
""" """
Start a bitcoind and return RPC connection to it Start a bitcoind and return RPC connection to it
""" """
datadir = os.path.join(dir, "node"+str(i)) datadir = os.path.join(dirname, "node"+str(i))
args = [ os.getenv("BITCOIND", "bitcoind"), "-datadir="+datadir, "-keypool=1", "-discover=0" ] args = [ os.getenv("BITCOIND", "bitcoind"), "-datadir="+datadir, "-keypool=1", "-discover=0" ]
if extra_args is not None: args.extend(extra_args) if extra_args is not None: args.extend(extra_args)
bitcoind_processes[i] = subprocess.Popen(args) bitcoind_processes[i] = subprocess.Popen(args)
@ -163,15 +163,15 @@ def start_node(i, dir, extra_args=None, rpchost=None):
proxy.url = url # store URL on proxy for info proxy.url = url # store URL on proxy for info
return proxy return proxy
def start_nodes(num_nodes, dir, extra_args=None, rpchost=None): def start_nodes(num_nodes, dirname, extra_args=None, rpchost=None):
""" """
Start multiple bitcoinds, return RPC connections to them Start multiple bitcoinds, return RPC connections to them
""" """
if extra_args is None: extra_args = [ None for i in range(num_nodes) ] if extra_args is None: extra_args = [ None for i in range(num_nodes) ]
return [ start_node(i, dir, extra_args[i], rpchost) for i in range(num_nodes) ] return [ start_node(i, dirname, extra_args[i], rpchost) for i in range(num_nodes) ]
def log_filename(dir, n_node, logname): def log_filename(dirname, n_node, logname):
return os.path.join(dir, "node"+str(n_node), "regtest", logname) return os.path.join(dirname, "node"+str(n_node), "regtest", logname)
def stop_node(node, i): def stop_node(node, i):
node.stop() node.stop()

Loading…
Cancel
Save