aboutsummaryrefslogtreecommitdiff
path: root/test/functional/feature_config_args.py
diff options
context:
space:
mode:
authorbrunoerg <brunoely.gc@gmail.com>2022-04-26 14:39:07 -0300
committerbrunoerg <brunoely.gc@gmail.com>2022-04-27 20:04:33 -0300
commit027aab663aaca32818051d456c3900326377281c (patch)
tree124f38ed34778b6d4c53af634c65017e52e6e862 /test/functional/feature_config_args.py
parent269dcad16e3d69f22c7a669c624beeb405111bbe (diff)
test, contrib, refactor: use `with` when opening a file
Diffstat (limited to 'test/functional/feature_config_args.py')
-rwxr-xr-xtest/functional/feature_config_args.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/functional/feature_config_args.py b/test/functional/feature_config_args.py
index eea5fa24ee..fe3196d5ee 100755
--- a/test/functional/feature_config_args.py
+++ b/test/functional/feature_config_args.py
@@ -247,7 +247,8 @@ class ConfArgsTest(BitcoinTestFramework):
conf_file = os.path.join(default_data_dir, "bitcoin.conf")
# datadir needs to be set before [chain] section
- conf_file_contents = open(conf_file, encoding='utf8').read()
+ with open(conf_file, encoding='utf8') as f:
+ conf_file_contents = f.read()
with open(conf_file, 'w', encoding='utf8') as f:
f.write(f"datadir={new_data_dir}\n")
f.write(conf_file_contents)