Skip to content

Commit 35000e3

Browse files
committed
Merge bitcoin/bitcoin#31433: test: #31212 follow up (spelling, refactor)
41d934c chore: Typo Overriden -> Overridden (Hodlinator) c9fb38a refactor test: Cleaner combine_logs.py logic (Hodlinator) Pull request description: - Fixes typo caught by spelling linter (https://github.com/bitcoin/bitcoin/runs/33979284676). - Minor but nice refactoring of *combine_logs.py* change that was suggested late: bitcoin/bitcoin#31212 (comment) ACKs for top commit: l0rinc: ACK 41d934c maflcko: lgtm ACK 41d934c theStack: ACK 41d934c BrandonOdiwuor: Code Review ACK 41d934c tdb3: ACK 41d934c Tree-SHA512: cf8ecc070d0b01df9c4e57a75820e17d4535591e85bf9d271c7b8f60875f7e04b9978c56e9b88c10e89e69ff755c35b23ed291949c32c875a91c3317105a3c79
2 parents 18d0cfb + 41d934c commit 35000e3

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

test/functional/combine_logs.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
# Copyright (c) 2017-2021 The Bitcoin Core developers
2+
# Copyright (c) 2017-present The Bitcoin Core developers
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Combine logs from multiple bitcoin nodes as well as the test_framework log.
@@ -81,13 +81,14 @@ def read_logs(tmp_dir):
8181

8282
# Find out what the folder is called that holds node 0's debug.log file
8383
debug_logs = list(pathlib.Path(tmp_dir).glob('node0/**/debug.log'))
84-
if len(debug_logs) > 0:
85-
assert len(debug_logs) < 2, 'Max one debug.log is supported, ' \
86-
'found several:\n\t' + '\n\t'.join([str(f) for f in debug_logs])
87-
path = debug_logs[0]
88-
chain = re.search(r'node0/(.+?)/debug\.log$', path.as_posix()).group(1) # extract the chain name
89-
else:
90-
chain = 'regtest' # fallback to regtest (should only happen when none exists)
84+
match len(debug_logs):
85+
case 0:
86+
chain = 'regtest' # fallback to regtest
87+
case 1:
88+
chain = re.search(r'node0/(.+?)/debug\.log$', debug_logs[0].as_posix()).group(1)
89+
case _:
90+
raise RuntimeError('Max one debug.log is supported, found several:\n\t' +
91+
'\n\t'.join(map(str, debug_logs)))
9192

9293
files = [("test", "%s/test_framework.log" % tmp_dir)]
9394
for i in itertools.count():

test/functional/feature_config_args.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
# Copyright (c) 2017-2022 The Bitcoin Core developers
2+
# Copyright (c) 2017-present The Bitcoin Core developers
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test various command line arguments and configuration file parameters."""
@@ -31,7 +31,7 @@ def set_test_params(self):
3131
def setup_network(self):
3232
self.setup_nodes()
3333

34-
# Overriden to not start nodes automatically - doing so is the
34+
# Overridden to not start nodes automatically - doing so is the
3535
# responsibility of each test function.
3636
def setup_nodes(self):
3737
self.add_nodes(self.num_nodes, self.extra_args)

0 commit comments

Comments
 (0)