mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-04 17:52:25 +01:00
Tests: Use self.chain instead of 'regtest' in almost all current tests
This commit is contained in:
@@ -38,7 +38,7 @@ class ConfArgsTest(BitcoinTestFramework):
|
||||
if self.is_wallet_compiled():
|
||||
with open(inc_conf_file_path, 'w', encoding='utf8') as conf:
|
||||
conf.write("wallet=foo\n")
|
||||
self.nodes[0].assert_start_raises_init_error(expected_msg='Error: Config setting for -wallet only applied on regtest network when in [regtest] section.')
|
||||
self.nodes[0].assert_start_raises_init_error(expected_msg='Error: Config setting for -wallet only applied on %s network when in [%s] section.' % (self.chain, self.chain))
|
||||
|
||||
with open(inc_conf_file_path, 'w', encoding='utf-8') as conf:
|
||||
conf.write('regtest=0\n') # mainnet
|
||||
@@ -103,7 +103,7 @@ class ConfArgsTest(BitcoinTestFramework):
|
||||
# Check that using non-existent datadir in conf file fails
|
||||
conf_file = os.path.join(default_data_dir, "bitcoin.conf")
|
||||
|
||||
# datadir needs to be set before [regtest] section
|
||||
# datadir needs to be set before [chain] section
|
||||
conf_file_contents = open(conf_file, encoding='utf8').read()
|
||||
with open(conf_file, 'w', encoding='utf8') as f:
|
||||
f.write("datadir=" + new_data_dir + "\n")
|
||||
@@ -115,17 +115,17 @@ class ConfArgsTest(BitcoinTestFramework):
|
||||
os.mkdir(new_data_dir)
|
||||
self.start_node(0, ['-conf='+conf_file, '-wallet=w1'])
|
||||
self.stop_node(0)
|
||||
assert os.path.exists(os.path.join(new_data_dir, 'regtest', 'blocks'))
|
||||
assert os.path.exists(os.path.join(new_data_dir, self.chain, 'blocks'))
|
||||
if self.is_wallet_compiled():
|
||||
assert os.path.exists(os.path.join(new_data_dir, 'regtest', 'wallets', 'w1'))
|
||||
assert os.path.exists(os.path.join(new_data_dir, self.chain, 'wallets', 'w1'))
|
||||
|
||||
# Ensure command line argument overrides datadir in conf
|
||||
os.mkdir(new_data_dir_2)
|
||||
self.nodes[0].datadir = new_data_dir_2
|
||||
self.start_node(0, ['-datadir='+new_data_dir_2, '-conf='+conf_file, '-wallet=w2'])
|
||||
assert os.path.exists(os.path.join(new_data_dir_2, 'regtest', 'blocks'))
|
||||
assert os.path.exists(os.path.join(new_data_dir_2, self.chain, 'blocks'))
|
||||
if self.is_wallet_compiled():
|
||||
assert os.path.exists(os.path.join(new_data_dir_2, 'regtest', 'wallets', 'w2'))
|
||||
assert os.path.exists(os.path.join(new_data_dir_2, self.chain, 'wallets', 'w2'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user