From 25c830a533697b9a12cff1abd2fd7d576b34fd72 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Wed, 10 Apr 2019 22:12:02 +0200 Subject: [PATCH] pytest: Have bitcoind remember its config file There were a few places we were rebuilding the config path by appending `bitcoin.conf` to the bitcoin directory. So now we just remember it and reference it instead. Signed-off-by: Christian Decker --- tests/btcproxy.py | 3 +-- tests/utils.py | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/btcproxy.py b/tests/btcproxy.py index 3746ed3e3..3f8c9c7cc 100644 --- a/tests/btcproxy.py +++ b/tests/btcproxy.py @@ -34,8 +34,7 @@ class BitcoinRpcProxy(object): self.request_count = 0 def _handle_request(self, r): - conf_file = os.path.join(self.bitcoind.bitcoin_dir, 'bitcoin.conf') - brpc = BitcoinProxy(btc_conf_file=conf_file) + brpc = BitcoinProxy(btc_conf_file=self.bitcoind.conf_file) method = r['method'] # If we have set a mock for this method reply with that instead of diff --git a/tests/utils.py b/tests/utils.py index 2ce1cc43c..efa659395 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -305,9 +305,9 @@ class BitcoinD(TailableProc): # For after 0.16.1 (eg. 3f398d7a17f136cd4a67998406ca41a124ae2966), this # needs its own [regtest] section. BITCOIND_REGTEST = {'rpcport': rpcport} - btc_conf_file = os.path.join(bitcoin_dir, 'bitcoin.conf') - write_config(btc_conf_file, BITCOIND_CONFIG, BITCOIND_REGTEST) - self.rpc = SimpleBitcoinProxy(btc_conf_file=btc_conf_file) + self.conf_file = os.path.join(bitcoin_dir, 'bitcoin.conf') + write_config(self.conf_file, BITCOIND_CONFIG, BITCOIND_REGTEST) + self.rpc = SimpleBitcoinProxy(btc_conf_file=self.conf_file) self.proxies = [] def start(self):