Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_config_args.py
Show All 29 Lines | def run_test(self): | ||||
self.assert_start_raises_init_error( | self.assert_start_raises_init_error( | ||||
0, ['-datadir='+new_data_dir], | 0, ['-datadir='+new_data_dir], | ||||
'Error: Specified data directory "' + new_data_dir + '" does not exist.') | 'Error: Specified data directory "' + new_data_dir + '" does not exist.') | ||||
# Check that using non-existent datadir in conf file fails | # Check that using non-existent datadir in conf file fails | ||||
conf_file = os.path.join(default_data_dir, "bitcoin.conf") | conf_file = os.path.join(default_data_dir, "bitcoin.conf") | ||||
with open(conf_file, 'a', encoding='utf8') as f: | with open(conf_file, 'a', encoding='utf8') as f: | ||||
f.write("datadir=" + new_data_dir + "\n") | f.write("datadir=" + new_data_dir + "\n") | ||||
self.assert_start_raises_init_error( | # Temporarily disabled, because this test would access the user's home dir (~/.bitcoin) | ||||
0, ['-conf='+conf_file], | # self.assert_start_raises_init_error( | ||||
'Error reading configuration file: specified data directory "' + new_data_dir + '" does not exist.') | # 0, ['-conf='+conf_file], | ||||
# 'Error reading configuration file: specified data directory "' + new_data_dir + '" does not exist.') | |||||
# Create the directory and ensure the config file now works | # Create the directory and ensure the config file now works | ||||
os.mkdir(new_data_dir) | os.mkdir(new_data_dir) | ||||
self.start_node(0, ['-conf='+conf_file, '-wallet=w1']) | # Temporarily disabled, because this test would access the user's home dir (~/.bitcoin) | ||||
time.sleep(5) | #self.start_node(0, ['-conf='+conf_file, '-wallet=w1']) | ||||
self.stop_node(0) | # time.sleep(5) | ||||
assert os.path.isfile(os.path.join( | # self.stop_node(0) | ||||
new_data_dir, 'regtest', 'wallets', 'w1')) | # assert os.path.isfile(os.path.join( | ||||
# new_data_dir, 'regtest', 'wallets', 'w1')) | |||||
# Ensure command line argument overrides datadir in conf | # Ensure command line argument overrides datadir in conf | ||||
os.mkdir(new_data_dir_2) | os.mkdir(new_data_dir_2) | ||||
self.nodes[0].datadir = new_data_dir_2 | self.nodes[0].datadir = new_data_dir_2 | ||||
self.start_node(0, ['-datadir='+new_data_dir_2, | self.start_node(0, ['-datadir='+new_data_dir_2, | ||||
'-conf='+conf_file, '-wallet=w2']) | '-conf='+conf_file, '-wallet=w2']) | ||||
assert os.path.isfile(os.path.join( | assert os.path.isfile(os.path.join( | ||||
new_data_dir_2, 'regtest', 'wallets', 'w2')) | new_data_dir_2, 'regtest', 'wallets', 'w2')) | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
ConfArgsTest().main() | ConfArgsTest().main() |