diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-06-16 07:39:18 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-06-16 08:27:57 -0400 |
commit | faa841bc979ca306f5ba4d5f7b78fcc427b8e413 (patch) | |
tree | e3fbfeadec7eed9b5070ecdea2759120cb4a9d54 /test | |
parent | 0afbeb73ccb7523794e1e4a3422607c4423d1048 (diff) |
test: refactor: Inline adjust_bitcoin_conf_for_pre_17
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/feature_backwards_compatibility.py | 3 | ||||
-rwxr-xr-x | test/functional/mempool_compatibility.py | 5 | ||||
-rwxr-xr-x | test/functional/test_framework/test_framework.py | 12 | ||||
-rw-r--r-- | test/functional/test_framework/util.py | 6 | ||||
-rwxr-xr-x | test/functional/wallet_upgradewallet.py | 4 |
5 files changed, 11 insertions, 19 deletions
diff --git a/test/functional/feature_backwards_compatibility.py b/test/functional/feature_backwards_compatibility.py index 596ff206f2..0ab309f9b9 100755 --- a/test/functional/feature_backwards_compatibility.py +++ b/test/functional/feature_backwards_compatibility.py @@ -26,7 +26,6 @@ from test_framework.test_framework import BitcoinTestFramework from test_framework.descriptors import descsum_create from test_framework.util import ( - adjust_bitcoin_conf_for_pre_17, assert_equal, sync_blocks, sync_mempools, @@ -60,8 +59,6 @@ class BackwardsCompatibilityTest(BitcoinTestFramework): 170100, 160300, ]) - # adapt bitcoin.conf, because older bitcoind's don't recognize config sections - adjust_bitcoin_conf_for_pre_17(self.nodes[5].bitcoinconf) self.start_nodes() diff --git a/test/functional/mempool_compatibility.py b/test/functional/mempool_compatibility.py index eb2fee11ae..999399dec0 100755 --- a/test/functional/mempool_compatibility.py +++ b/test/functional/mempool_compatibility.py @@ -16,9 +16,7 @@ Only v0.15.2 is required by this test. The rest is used in other backwards compa import os from test_framework.test_framework import BitcoinTestFramework -from test_framework.util import ( - adjust_bitcoin_conf_for_pre_17 -) + class MempoolCompatibilityTest(BitcoinTestFramework): def set_test_params(self): @@ -33,7 +31,6 @@ class MempoolCompatibilityTest(BitcoinTestFramework): 150200, # oldest version supported by the test framework None, ]) - adjust_bitcoin_conf_for_pre_17(self.nodes[0].bitcoinconf) self.start_nodes() self.import_deterministic_coinbase_privkeys() diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index 9f5e9e5f0d..c9fad91481 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -452,7 +452,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): assert_equal(len(binary), num_nodes) assert_equal(len(binary_cli), num_nodes) for i in range(num_nodes): - self.nodes.append(TestNode( + test_node_i = TestNode( i, get_datadir_path(self.options.tmpdir, i), chain=self.chain, @@ -470,7 +470,15 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): start_perf=self.options.perf, use_valgrind=self.options.valgrind, descriptors=self.options.descriptors, - )) + ) + self.nodes.append(test_node_i) + if not test_node_i.version_is_at_least(170000): + # adjust conf for pre 17 + conf_file = test_node_i.bitcoinconf + with open(conf_file, 'r', encoding='utf8') as conf: + conf_data = conf.read() + with open(conf_file, 'w', encoding='utf8') as conf: + conf.write(conf_data.replace('[regtest]', '')) def start_node(self, i, *args, **kwargs): """Start a bitcoind""" diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index 52306c8c3d..f1e8cc95c8 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -327,12 +327,6 @@ def initialize_datadir(dirname, n, chain): os.makedirs(os.path.join(datadir, 'stdout'), exist_ok=True) return datadir -def adjust_bitcoin_conf_for_pre_17(conf_file): - with open(conf_file,'r', encoding='utf8') as conf: - conf_data = conf.read() - with open(conf_file, 'w', encoding='utf8') as conf: - conf_data_changed = conf_data.replace('[regtest]', '') - conf.write(conf_data_changed) def get_datadir_path(dirname, n): return os.path.join(dirname, "node" + str(n)) diff --git a/test/functional/wallet_upgradewallet.py b/test/functional/wallet_upgradewallet.py index bb81746715..cc2139a027 100755 --- a/test/functional/wallet_upgradewallet.py +++ b/test/functional/wallet_upgradewallet.py @@ -16,7 +16,6 @@ import shutil from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( - adjust_bitcoin_conf_for_pre_17, assert_equal, assert_greater_than, assert_is_hex_string, @@ -46,9 +45,6 @@ class UpgradeWalletTest(BitcoinTestFramework): 160300, 150200, ]) - # adapt bitcoin.conf, because older bitcoind's don't recognize config sections - adjust_bitcoin_conf_for_pre_17(self.nodes[1].bitcoinconf) - adjust_bitcoin_conf_for_pre_17(self.nodes[2].bitcoinconf) self.start_nodes() def dumb_sync_blocks(self): |