Skip to content

Commit fac4909

Browse files
author
MarcoFalke
committed
test: Remove duplicate ConfigParser
It is sufficient to parse once.
1 parent 5757de4 commit fac4909

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

test/functional/rpc_users.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import subprocess
1818
from random import SystemRandom
1919
import string
20-
import configparser
2120
import sys
2221
from typing import Optional
2322

@@ -47,9 +46,7 @@ def conf_setup(self):
4746
self.rpcuser = "rpcuser💻"
4847
self.rpcpassword = "rpcpassword🔑"
4948

50-
config = configparser.ConfigParser()
51-
config.read_file(open(self.options.configfile))
52-
gen_rpcauth = config['environment']['RPCAUTH']
49+
gen_rpcauth = self.config["environment"]["RPCAUTH"]
5350

5451
# Generate RPCAUTH with specified password
5552
self.rt2password = "8/F3uMDw4KSEbw96U3CA1C4X05dkHDN2BPFjTgZW4KI="

test/functional/test_framework/test_framework.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,8 @@ def parse_args(self, test_file):
272272
self.options.timeout_factor = self.options.timeout_factor or (4 if self.options.valgrind else 1)
273273
self.options.previous_releases_path = previous_releases_path
274274

275-
config = configparser.ConfigParser()
276-
config.read_file(open(self.options.configfile))
277-
self.config = config
275+
self.config = configparser.ConfigParser()
276+
self.config.read_file(open(self.options.configfile))
278277
self.binary_paths = self.get_binary_paths()
279278
if self.options.v1transport:
280279
self.options.v2transport=False
@@ -314,10 +313,8 @@ def setup(self):
314313

315314
self.options.cachedir = os.path.abspath(self.options.cachedir)
316315

317-
config = self.config
318-
319316
os.environ['PATH'] = os.pathsep.join([
320-
os.path.join(config['environment']['BUILDDIR'], 'bin'),
317+
os.path.join(self.config["environment"]["BUILDDIR"], "bin"),
321318
os.environ['PATH']
322319
])
323320

0 commit comments

Comments
 (0)