MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / replace_in_config

Method replace_in_config

test/functional/test_framework/test_node.py:535–548  ·  view source on GitHub ↗

Perform replacements in the configuration file. The substitutions are passed as a list of search-replace-tuples, e.g. [("old", "new"), ("foo", "bar"), ...]

(self, replacements)

Source from the content-addressed store, hash-verified

533 assert self.is_node_stopped()
534
535 def replace_in_config(self, replacements):
536 """
537 Perform replacements in the configuration file.
538 The substitutions are passed as a list of search-replace-tuples, e.g.
539 [("old", "new"), ("foo", "bar"), ...]
540 """
541 with open(self.bitcoinconf, 'r') as conf:
542 conf_data = conf.read()
543 for replacement in replacements:
544 assert_equal(len(replacement), 2)
545 old, new = replacement[0], replacement[1]
546 conf_data = conf_data.replace(old, new)
547 with open(self.bitcoinconf, 'w') as conf:
548 conf.write(conf_data)
549
550 @property
551 def chain_path(self) -> Path:

Callers 11

add_nodesMethod · 0.95
run_testMethod · 0.80
run_testMethod · 0.80
test_rpccookiepermsMethod · 0.80
run_testMethod · 0.80
test_dir_configMethod · 0.80
run_testMethod · 0.80
setup_networkMethod · 0.80

Calls 3

assert_equalFunction · 0.85
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected