don't override dir() in qa rpc tests

Replace "dir" with "dirname" in util.py in qa/rpc-tests/ because "dir"
is the name of a function in python.
This commit is contained in:
Bryan Bishop 2014-11-14 09:12:41 -06:00
parent 3d3ce7421e
commit a7af9839d6

View File

@ -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()