aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-01-17 21:46:35 +0100
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-01-18 13:00:34 +0100
commitfa8fe5b69669b4d86e0d0970d68502abee8785f3 (patch)
tree177964f91bff38cb4b517fec698274febfd5492d
parentfa2a23548aa9656e397189d8da844657709fb831 (diff)
downloadbitcoin-fa8fe5b69669b4d86e0d0970d68502abee8785f3.tar.xz
scripted-diff: Use new python 3.7 keywords
-BEGIN VERIFY SCRIPT- sed -i 's/universal_newlines/text/g' $(git grep -l universal_newlines) -END VERIFY SCRIPT-
-rwxr-xr-xcontrib/devtools/clang-format-diff.py2
-rwxr-xr-xcontrib/devtools/gen-manpages.py4
-rwxr-xr-xcontrib/devtools/test-security-check.py2
-rwxr-xr-xcontrib/devtools/test-symbol-check.py4
-rwxr-xr-xcontrib/macdeploy/macdeployqtplus10
-rwxr-xr-xtest/functional/rpc_users.py4
-rwxr-xr-xtest/functional/test_framework/test_node.py2
-rwxr-xr-xtest/functional/test_runner.py4
-rwxr-xr-xtest/functional/tool_wallet.py2
-rwxr-xr-xtest/fuzz/test_runner.py10
-rwxr-xr-xtest/lint/lint-assertions.py2
-rwxr-xr-xtest/lint/lint-circular-dependencies.py4
-rwxr-xr-xtest/lint/lint-git-commit-check.py6
-rwxr-xr-xtest/lint/lint-includes.py14
-rwxr-xr-xtest/lint/lint-locale-dependence.py2
-rwxr-xr-xtest/lint/lint-logs.py2
-rwxr-xr-xtest/lint/lint-python-mutable-default-parameters.py2
-rwxr-xr-xtest/lint/lint-python-utf8-encoding.py6
-rwxr-xr-xtest/lint/lint-shell.py2
-rwxr-xr-xtest/lint/lint-submodule.py2
-rwxr-xr-xtest/lint/lint-tests.py2
-rwxr-xr-xtest/lint/lint-whitespace.py4
-rwxr-xr-xtest/util/test_runner.py2
23 files changed, 47 insertions, 47 deletions
diff --git a/contrib/devtools/clang-format-diff.py b/contrib/devtools/clang-format-diff.py
index 98eee67f43..420bf7ff33 100755
--- a/contrib/devtools/clang-format-diff.py
+++ b/contrib/devtools/clang-format-diff.py
@@ -146,7 +146,7 @@ def main():
stdout=subprocess.PIPE,
stderr=None,
stdin=subprocess.PIPE,
- universal_newlines=True)
+ text=True)
stdout, stderr = p.communicate()
if p.returncode != 0:
sys.exit(p.returncode)
diff --git a/contrib/devtools/gen-manpages.py b/contrib/devtools/gen-manpages.py
index 38cdb3acb8..2860e7db99 100755
--- a/contrib/devtools/gen-manpages.py
+++ b/contrib/devtools/gen-manpages.py
@@ -23,7 +23,7 @@ help2man = os.getenv('HELP2MAN', 'help2man')
# If not otherwise specified, get top directory from git.
topdir = os.getenv('TOPDIR')
if not topdir:
- r = subprocess.run([git, 'rev-parse', '--show-toplevel'], stdout=subprocess.PIPE, check=True, universal_newlines=True)
+ r = subprocess.run([git, 'rev-parse', '--show-toplevel'], stdout=subprocess.PIPE, check=True, text=True)
topdir = r.stdout.rstrip()
# Get input and output directories.
@@ -36,7 +36,7 @@ versions = []
for relpath in BINARIES:
abspath = os.path.join(builddir, relpath)
try:
- r = subprocess.run([abspath, "--version"], stdout=subprocess.PIPE, check=True, universal_newlines=True)
+ r = subprocess.run([abspath, "--version"], stdout=subprocess.PIPE, check=True, text=True)
except IOError:
print(f'{abspath} not found or not an executable', file=sys.stderr)
sys.exit(1)
diff --git a/contrib/devtools/test-security-check.py b/contrib/devtools/test-security-check.py
index fe61ab275f..54718fd7a1 100755
--- a/contrib/devtools/test-security-check.py
+++ b/contrib/devtools/test-security-check.py
@@ -39,7 +39,7 @@ def call_security_check(cc, source, executable, options):
env_flags += filter(None, os.environ.get(var, '').split(' '))
subprocess.run([*cc,source,'-o',executable] + env_flags + options, check=True)
- p = subprocess.run([os.path.join(os.path.dirname(__file__), 'security-check.py'), executable], stdout=subprocess.PIPE, universal_newlines=True)
+ p = subprocess.run([os.path.join(os.path.dirname(__file__), 'security-check.py'), executable], stdout=subprocess.PIPE, text=True)
return (p.returncode, p.stdout.rstrip())
def get_arch(cc, source, executable):
diff --git a/contrib/devtools/test-symbol-check.py b/contrib/devtools/test-symbol-check.py
index 624870ebcb..de73b02090 100755
--- a/contrib/devtools/test-symbol-check.py
+++ b/contrib/devtools/test-symbol-check.py
@@ -23,13 +23,13 @@ def call_symbol_check(cc: List[str], source, executable, options):
env_flags += filter(None, os.environ.get(var, '').split(' '))
subprocess.run([*cc,source,'-o',executable] + env_flags + options, check=True)
- p = subprocess.run([os.path.join(os.path.dirname(__file__), 'symbol-check.py'), executable], stdout=subprocess.PIPE, universal_newlines=True)
+ p = subprocess.run([os.path.join(os.path.dirname(__file__), 'symbol-check.py'), executable], stdout=subprocess.PIPE, text=True)
os.remove(source)
os.remove(executable)
return (p.returncode, p.stdout.rstrip())
def get_machine(cc: List[str]):
- p = subprocess.run([*cc,'-dumpmachine'], stdout=subprocess.PIPE, universal_newlines=True)
+ p = subprocess.run([*cc,'-dumpmachine'], stdout=subprocess.PIPE, text=True)
return p.stdout.rstrip()
class TestSymbolChecks(unittest.TestCase):
diff --git a/contrib/macdeploy/macdeployqtplus b/contrib/macdeploy/macdeployqtplus
index 2420539b7c..f8677ba7b8 100755
--- a/contrib/macdeploy/macdeployqtplus
+++ b/contrib/macdeploy/macdeployqtplus
@@ -187,7 +187,7 @@ def getFrameworks(binaryPath: str, verbose: int) -> List[FrameworkInfo]:
if verbose:
print(f"Inspecting with otool: {binaryPath}")
otoolbin=os.getenv("OTOOL", "otool")
- otool = run([otoolbin, "-L", binaryPath], stdout=PIPE, stderr=PIPE, universal_newlines=True)
+ otool = run([otoolbin, "-L", binaryPath], stdout=PIPE, stderr=PIPE, text=True)
if otool.returncode != 0:
sys.stderr.write(otool.stderr)
sys.stderr.flush()
@@ -577,17 +577,17 @@ if config.dmg is not None:
tempname: str = appname + ".temp.dmg"
- run(["hdiutil", "create", tempname, "-srcfolder", "dist", "-format", "UDRW", "-size", str(size), "-volname", appname], check=True, universal_newlines=True)
+ run(["hdiutil", "create", tempname, "-srcfolder", "dist", "-format", "UDRW", "-size", str(size), "-volname", appname], check=True, text=True)
if verbose:
print("Attaching temp image...")
- output = run(["hdiutil", "attach", tempname, "-readwrite"], check=True, universal_newlines=True, stdout=PIPE).stdout
+ output = run(["hdiutil", "attach", tempname, "-readwrite"], check=True, text=True, stdout=PIPE).stdout
print("+ Finalizing .dmg disk image +")
- run(["hdiutil", "detach", f"/Volumes/{appname}"], universal_newlines=True)
+ run(["hdiutil", "detach", f"/Volumes/{appname}"], text=True)
- run(["hdiutil", "convert", tempname, "-format", "UDZO", "-o", appname, "-imagekey", "zlib-level=9"], check=True, universal_newlines=True)
+ run(["hdiutil", "convert", tempname, "-format", "UDZO", "-o", appname, "-imagekey", "zlib-level=9"], check=True, text=True)
os.unlink(tempname)
diff --git a/test/functional/rpc_users.py b/test/functional/rpc_users.py
index 560f226469..8cc3ec401e 100755
--- a/test/functional/rpc_users.py
+++ b/test/functional/rpc_users.py
@@ -53,13 +53,13 @@ class HTTPBasicsTest(BitcoinTestFramework):
# Generate RPCAUTH with specified password
self.rt2password = "8/F3uMDw4KSEbw96U3CA1C4X05dkHDN2BPFjTgZW4KI="
- p = subprocess.Popen([sys.executable, gen_rpcauth, 'rt2', self.rt2password], stdout=subprocess.PIPE, universal_newlines=True)
+ p = subprocess.Popen([sys.executable, gen_rpcauth, 'rt2', self.rt2password], stdout=subprocess.PIPE, text=True)
lines = p.stdout.read().splitlines()
rpcauth2 = lines[1]
# Generate RPCAUTH without specifying password
self.user = ''.join(SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(10))
- p = subprocess.Popen([sys.executable, gen_rpcauth, self.user], stdout=subprocess.PIPE, universal_newlines=True)
+ p = subprocess.Popen([sys.executable, gen_rpcauth, self.user], stdout=subprocess.PIPE, text=True)
lines = p.stdout.read().splitlines()
rpcauth3 = lines[1]
self.password = lines[3]
diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py
index 8585972cb3..f3d81ed7da 100755
--- a/test/functional/test_framework/test_node.py
+++ b/test/functional/test_framework/test_node.py
@@ -730,7 +730,7 @@ class TestNodeCLI():
p_args += [command]
p_args += pos_args + named_args
self.log.debug("Running bitcoin-cli {}".format(p_args[2:]))
- process = subprocess.Popen(p_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
+ process = subprocess.Popen(p_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
cli_stdout, cli_stderr = process.communicate(input=self.input)
returncode = process.poll()
if returncode:
diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py
index 4b9bf11d0e..569af0ee9b 100755
--- a/test/functional/test_runner.py
+++ b/test/functional/test_runner.py
@@ -585,7 +585,7 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=
combined_logs_args = [sys.executable, os.path.join(tests_dir, 'combine_logs.py'), testdir]
if BOLD[0]:
combined_logs_args += ['--color']
- combined_logs, _ = subprocess.Popen(combined_logs_args, universal_newlines=True, stdout=subprocess.PIPE).communicate()
+ combined_logs, _ = subprocess.Popen(combined_logs_args, text=True, stdout=subprocess.PIPE).communicate()
print("\n".join(deque(combined_logs.splitlines(), combined_logs_len)))
if failfast:
@@ -670,7 +670,7 @@ class TestHandler:
self.jobs.append((test,
time.time(),
subprocess.Popen([sys.executable, self.tests_dir + test_argv[0]] + test_argv[1:] + self.flags + portseed_arg + tmpdir_arg,
- universal_newlines=True,
+ text=True,
stdout=log_stdout,
stderr=log_stderr),
testdir,
diff --git a/test/functional/tool_wallet.py b/test/functional/tool_wallet.py
index 4a321c2fc4..a888f93b03 100755
--- a/test/functional/tool_wallet.py
+++ b/test/functional/tool_wallet.py
@@ -37,7 +37,7 @@ class ToolWalletTest(BitcoinTestFramework):
if not self.options.descriptors and 'create' in args:
default_args.append('-legacy')
- return subprocess.Popen([binary] + default_args + list(args), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
+ return subprocess.Popen([binary] + default_args + list(args), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
def assert_raises_tool_error(self, error, *args):
p = self.bitcoin_wallet_process(*args)
diff --git a/test/fuzz/test_runner.py b/test/fuzz/test_runner.py
index e2eab2a0fe..af21e7b956 100755
--- a/test/fuzz/test_runner.py
+++ b/test/fuzz/test_runner.py
@@ -143,7 +143,7 @@ def main():
timeout=20,
check=True,
stderr=subprocess.PIPE,
- universal_newlines=True,
+ text=True,
).stderr
if "libFuzzer" not in help_output:
logging.error("Must be built with libFuzzer")
@@ -200,7 +200,7 @@ def generate_corpus(*, fuzz_pool, src_dir, build_dir, corpus_dir, targets):
env=get_fuzz_env(target=t, source_dir=src_dir),
check=True,
stderr=subprocess.PIPE,
- universal_newlines=True,
+ text=True,
).stderr))
futures = []
@@ -241,7 +241,7 @@ def merge_inputs(*, fuzz_pool, corpus, test_list, src_dir, build_dir, merge_dir)
env=get_fuzz_env(target=t, source_dir=src_dir),
check=True,
stderr=subprocess.PIPE,
- universal_newlines=True,
+ text=True,
).stderr
logging.debug(output)
@@ -270,7 +270,7 @@ def run_once(*, fuzz_pool, corpus, test_list, src_dir, build_dir, use_valgrind):
args,
env=get_fuzz_env(target=t, source_dir=src_dir),
stderr=subprocess.PIPE,
- universal_newlines=True,
+ text=True,
)
output += result.stderr
return output, result
@@ -299,7 +299,7 @@ def parse_test_list(*, fuzz_bin):
},
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
- universal_newlines=True,
+ text=True,
).stdout.splitlines()
return test_list_all
diff --git a/test/lint/lint-assertions.py b/test/lint/lint-assertions.py
index 195ff33d11..e7eecebce5 100755
--- a/test/lint/lint-assertions.py
+++ b/test/lint/lint-assertions.py
@@ -12,7 +12,7 @@ import subprocess
def git_grep(params: [], error_msg: ""):
try:
- output = subprocess.check_output(["git", "grep", *params], universal_newlines=True, encoding="utf8")
+ output = subprocess.check_output(["git", "grep", *params], text=True, encoding="utf8")
print(error_msg)
print(output)
return 1
diff --git a/test/lint/lint-circular-dependencies.py b/test/lint/lint-circular-dependencies.py
index b69bbe7cd0..cf6a5f81f1 100755
--- a/test/lint/lint-circular-dependencies.py
+++ b/test/lint/lint-circular-dependencies.py
@@ -38,14 +38,14 @@ def main():
os.chdir(CODE_DIR)
files = subprocess.check_output(
['git', 'ls-files', '--', '*.h', '*.cpp'],
- universal_newlines=True,
+ text=True,
).splitlines()
command = [sys.executable, "../contrib/devtools/circular-dependencies.py", *files]
dependencies_output = subprocess.run(
command,
stdout=subprocess.PIPE,
- universal_newlines=True,
+ text=True,
)
for dependency_str in dependencies_output.stdout.rstrip().split("\n"):
diff --git a/test/lint/lint-git-commit-check.py b/test/lint/lint-git-commit-check.py
index 049104398a..5897a17e70 100755
--- a/test/lint/lint-git-commit-check.py
+++ b/test/lint/lint-git-commit-check.py
@@ -42,17 +42,17 @@ def main():
commit_range = "HEAD~" + args.prev_commits + "...HEAD"
else:
# This assumes that the target branch of the pull request will be master.
- merge_base = check_output(["git", "merge-base", "HEAD", "master"], universal_newlines=True, encoding="utf8").rstrip("\n")
+ merge_base = check_output(["git", "merge-base", "HEAD", "master"], text=True, encoding="utf8").rstrip("\n")
commit_range = merge_base + "..HEAD"
else:
commit_range = os.getenv("COMMIT_RANGE")
if commit_range == "SKIP_EMPTY_NOT_A_PR":
sys.exit(0)
- commit_hashes = check_output(["git", "log", commit_range, "--format=%H"], universal_newlines=True, encoding="utf8").splitlines()
+ commit_hashes = check_output(["git", "log", commit_range, "--format=%H"], text=True, encoding="utf8").splitlines()
for hash in commit_hashes:
- commit_info = check_output(["git", "log", "--format=%B", "-n", "1", hash], universal_newlines=True, encoding="utf8").splitlines()
+ commit_info = check_output(["git", "log", "--format=%B", "-n", "1", hash], text=True, encoding="utf8").splitlines()
if len(commit_info) >= 2:
if commit_info[1]:
print(f"The subject line of commit hash {hash} is followed by a non-empty line. Subject lines should always be followed by a blank line.")
diff --git a/test/lint/lint-includes.py b/test/lint/lint-includes.py
index b3fa4b9303..459030bb0b 100755
--- a/test/lint/lint-includes.py
+++ b/test/lint/lint-includes.py
@@ -35,13 +35,13 @@ EXPECTED_BOOST_INCLUDES = ["boost/date_time/posix_time/posix_time.hpp",
def get_toplevel():
- return check_output(["git", "rev-parse", "--show-toplevel"], universal_newlines=True, encoding="utf8").rstrip("\n")
+ return check_output(["git", "rev-parse", "--show-toplevel"], text=True, encoding="utf8").rstrip("\n")
def list_files_by_suffix(suffixes):
exclude_args = [":(exclude)" + dir for dir in EXCLUDED_DIRS]
- files_list = check_output(["git", "ls-files", "src"] + exclude_args, universal_newlines=True, encoding="utf8").splitlines()
+ files_list = check_output(["git", "ls-files", "src"] + exclude_args, text=True, encoding="utf8").splitlines()
return [file for file in files_list if file.endswith(suffixes)]
@@ -63,7 +63,7 @@ def find_included_cpps():
included_cpps = list()
try:
- included_cpps = check_output(["git", "grep", "-E", r"^#include [<\"][^>\"]+\.cpp[>\"]", "--", "*.cpp", "*.h"], universal_newlines=True, encoding="utf8").splitlines()
+ included_cpps = check_output(["git", "grep", "-E", r"^#include [<\"][^>\"]+\.cpp[>\"]", "--", "*.cpp", "*.h"], text=True, encoding="utf8").splitlines()
except CalledProcessError as e:
if e.returncode > 1:
raise e
@@ -77,7 +77,7 @@ def find_extra_boosts():
exclusion_set = set()
try:
- included_boosts = check_output(["git", "grep", "-E", r"^#include <boost/", "--", "*.cpp", "*.h"], universal_newlines=True, encoding="utf8").splitlines()
+ included_boosts = check_output(["git", "grep", "-E", r"^#include <boost/", "--", "*.cpp", "*.h"], text=True, encoding="utf8").splitlines()
except CalledProcessError as e:
if e.returncode > 1:
raise e
@@ -100,7 +100,7 @@ def find_quote_syntax_inclusions():
quote_syntax_inclusions = list()
try:
- quote_syntax_inclusions = check_output(["git", "grep", r"^#include \"", "--", "*.cpp", "*.h"] + exclude_args, universal_newlines=True, encoding="utf8").splitlines()
+ quote_syntax_inclusions = check_output(["git", "grep", r"^#include \"", "--", "*.cpp", "*.h"] + exclude_args, text=True, encoding="utf8").splitlines()
except CalledProcessError as e:
if e.returncode > 1:
raise e
@@ -143,13 +143,13 @@ def main():
if extra_boosts:
for boost in extra_boosts:
print(f"A new Boost dependency in the form of \"{boost}\" appears to have been introduced:")
- print(check_output(["git", "grep", boost, "--", "*.cpp", "*.h"], universal_newlines=True, encoding="utf8"))
+ print(check_output(["git", "grep", boost, "--", "*.cpp", "*.h"], text=True, encoding="utf8"))
exit_code = 1
# Check if Boost dependencies are no longer used
for expected_boost in EXPECTED_BOOST_INCLUDES:
try:
- check_output(["git", "grep", "-q", r"^#include <%s>" % expected_boost, "--", "*.cpp", "*.h"], universal_newlines=True, encoding="utf8")
+ check_output(["git", "grep", "-q", r"^#include <%s>" % expected_boost, "--", "*.cpp", "*.h"], text=True, encoding="utf8")
except CalledProcessError as e:
if e.returncode > 1:
raise e
diff --git a/test/lint/lint-locale-dependence.py b/test/lint/lint-locale-dependence.py
index ce7444cd1a..c5cb34b20a 100755
--- a/test/lint/lint-locale-dependence.py
+++ b/test/lint/lint-locale-dependence.py
@@ -223,7 +223,7 @@ def find_locale_dependent_function_uses():
git_grep_output = list()
try:
- git_grep_output = check_output(git_grep_command, universal_newlines=True, encoding="utf8").splitlines()
+ git_grep_output = check_output(git_grep_command, text=True, encoding="utf8").splitlines()
except CalledProcessError as e:
if e.returncode > 1:
raise e
diff --git a/test/lint/lint-logs.py b/test/lint/lint-logs.py
index aaf697467d..de04a1aeca 100755
--- a/test/lint/lint-logs.py
+++ b/test/lint/lint-logs.py
@@ -16,7 +16,7 @@ from subprocess import check_output
def main():
- logs_list = check_output(["git", "grep", "--extended-regexp", r"(LogPrintLevel|LogPrintfCategory|LogPrintf?)\(", "--", "*.cpp"], universal_newlines=True, encoding="utf8").splitlines()
+ logs_list = check_output(["git", "grep", "--extended-regexp", r"(LogPrintLevel|LogPrintfCategory|LogPrintf?)\(", "--", "*.cpp"], text=True, encoding="utf8").splitlines()
unterminated_logs = [line for line in logs_list if not re.search(r'(\\n"|/\* Continued \*/)', line)]
diff --git a/test/lint/lint-python-mutable-default-parameters.py b/test/lint/lint-python-mutable-default-parameters.py
index 3dfc5940f7..820595ea34 100755
--- a/test/lint/lint-python-mutable-default-parameters.py
+++ b/test/lint/lint-python-mutable-default-parameters.py
@@ -21,7 +21,7 @@ def main():
"--",
"*.py",
]
- output = subprocess.run(command, stdout=subprocess.PIPE, universal_newlines=True)
+ output = subprocess.run(command, stdout=subprocess.PIPE, text=True)
if len(output.stdout) > 0:
error_msg = (
"A mutable list or dict seems to be used as default parameter value:\n\n"
diff --git a/test/lint/lint-python-utf8-encoding.py b/test/lint/lint-python-utf8-encoding.py
index 62fdc34d50..364da63468 100755
--- a/test/lint/lint-python-utf8-encoding.py
+++ b/test/lint/lint-python-utf8-encoding.py
@@ -23,7 +23,7 @@ def check_fileopens():
fileopens = list()
try:
- fileopens = check_output(["git", "grep", r" open(", "--", "*.py"] + get_exclude_args(), universal_newlines=True, encoding="utf8").splitlines()
+ fileopens = check_output(["git", "grep", r" open(", "--", "*.py"] + get_exclude_args(), text=True, encoding="utf8").splitlines()
except CalledProcessError as e:
if e.returncode > 1:
raise e
@@ -37,12 +37,12 @@ def check_checked_outputs():
checked_outputs = list()
try:
- checked_outputs = check_output(["git", "grep", "check_output(", "--", "*.py"] + get_exclude_args(), universal_newlines=True, encoding="utf8").splitlines()
+ checked_outputs = check_output(["git", "grep", "check_output(", "--", "*.py"] + get_exclude_args(), text=True, encoding="utf8").splitlines()
except CalledProcessError as e:
if e.returncode > 1:
raise e
- filtered_checked_outputs = [checked_output for checked_output in checked_outputs if re.search(r"universal_newlines=True", checked_output) and not re.search(r"encoding=.(ascii|utf8|utf-8).", checked_output)]
+ filtered_checked_outputs = [checked_output for checked_output in checked_outputs if re.search(r"text=True", checked_output) and not re.search(r"encoding=.(ascii|utf8|utf-8).", checked_output)]
return filtered_checked_outputs
diff --git a/test/lint/lint-shell.py b/test/lint/lint-shell.py
index ed95024ef5..1646bf0d3e 100755
--- a/test/lint/lint-shell.py
+++ b/test/lint/lint-shell.py
@@ -25,7 +25,7 @@ def check_shellcheck_install():
sys.exit(0)
def get_files(command):
- output = subprocess.run(command, stdout=subprocess.PIPE, universal_newlines=True)
+ output = subprocess.run(command, stdout=subprocess.PIPE, text=True)
files = output.stdout.split('\n')
# remove whitespace element
diff --git a/test/lint/lint-submodule.py b/test/lint/lint-submodule.py
index 89d4c80f55..4d2fbf088f 100755
--- a/test/lint/lint-submodule.py
+++ b/test/lint/lint-submodule.py
@@ -13,7 +13,7 @@ import sys
def main():
submodules_list = subprocess.check_output(['git', 'submodule', 'status', '--recursive'],
- universal_newlines = True, encoding = 'utf8').rstrip('\n')
+ text = True, encoding = 'utf8').rstrip('\n')
if submodules_list:
print("These submodules were found, delete them:\n", submodules_list)
sys.exit(1)
diff --git a/test/lint/lint-tests.py b/test/lint/lint-tests.py
index 849ddcb961..1eeb7bb014 100755
--- a/test/lint/lint-tests.py
+++ b/test/lint/lint-tests.py
@@ -23,7 +23,7 @@ def grep_boost_fixture_test_suite():
"src/test/**.cpp",
"src/wallet/test/**.cpp",
]
- return subprocess.check_output(command, universal_newlines=True, encoding="utf8")
+ return subprocess.check_output(command, text=True, encoding="utf8")
def check_matching_test_names(test_suite_list):
diff --git a/test/lint/lint-whitespace.py b/test/lint/lint-whitespace.py
index 72b7ebc394..f5e4a776d0 100755
--- a/test/lint/lint-whitespace.py
+++ b/test/lint/lint-whitespace.py
@@ -80,7 +80,7 @@ def get_diff(commit_range, check_only_code):
else:
what_files = ["."]
- diff = check_output(["git", "diff", "-U0", commit_range, "--"] + what_files + exclude_args, universal_newlines=True, encoding="utf8")
+ diff = check_output(["git", "diff", "-U0", commit_range, "--"] + what_files + exclude_args, text=True, encoding="utf8")
return diff
@@ -93,7 +93,7 @@ def main():
commit_range = "HEAD~" + args.prev_commits + "...HEAD"
else:
# This assumes that the target branch of the pull request will be master.
- merge_base = check_output(["git", "merge-base", "HEAD", "master"], universal_newlines=True, encoding="utf8").rstrip("\n")
+ merge_base = check_output(["git", "merge-base", "HEAD", "master"], text=True, encoding="utf8").rstrip("\n")
commit_range = merge_base + "..HEAD"
else:
commit_range = os.getenv("COMMIT_RANGE")
diff --git a/test/util/test_runner.py b/test/util/test_runner.py
index 03db05c563..ea3626fa65 100755
--- a/test/util/test_runner.py
+++ b/test/util/test_runner.py
@@ -107,7 +107,7 @@ def bctest(testDir, testObj, buildenv):
raise Exception
# Run the test
- proc = subprocess.Popen(execrun, stdin=stdinCfg, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
+ proc = subprocess.Popen(execrun, stdin=stdinCfg, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
try:
outs = proc.communicate(input=inputData)
except OSError: