test: Remove duplicate ConfigParser

It is sufficient to parse once.
This commit is contained in:
MarcoFalke
2025-06-06 15:34:18 +02:00
parent 5757de4ddd
commit fac49094cd
2 changed files with 4 additions and 10 deletions

View File

@@ -17,7 +17,6 @@ import urllib.parse
import subprocess
from random import SystemRandom
import string
import configparser
import sys
from typing import Optional
@@ -47,9 +46,7 @@ class HTTPBasicsTest(BitcoinTestFramework):
self.rpcuser = "rpcuser💻"
self.rpcpassword = "rpcpassword🔑"
config = configparser.ConfigParser()
config.read_file(open(self.options.configfile))
gen_rpcauth = config['environment']['RPCAUTH']
gen_rpcauth = self.config["environment"]["RPCAUTH"]
# Generate RPCAUTH with specified password
self.rt2password = "8/F3uMDw4KSEbw96U3CA1C4X05dkHDN2BPFjTgZW4KI="

View File

@@ -272,9 +272,8 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
self.options.timeout_factor = self.options.timeout_factor or (4 if self.options.valgrind else 1)
self.options.previous_releases_path = previous_releases_path
config = configparser.ConfigParser()
config.read_file(open(self.options.configfile))
self.config = config
self.config = configparser.ConfigParser()
self.config.read_file(open(self.options.configfile))
self.binary_paths = self.get_binary_paths()
if self.options.v1transport:
self.options.v2transport=False
@@ -314,10 +313,8 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
self.options.cachedir = os.path.abspath(self.options.cachedir)
config = self.config
os.environ['PATH'] = os.pathsep.join([
os.path.join(config['environment']['BUILDDIR'], 'bin'),
os.path.join(self.config["environment"]["BUILDDIR"], "bin"),
os.environ['PATH']
])