Skip to content

Commit 1eb13f0

Browse files
committed
test: Add log messages to test/functional/tool_wallet.py
and update code comments as per Python PEP 8 style guide.
1 parent 04710b6 commit 1eb13f0

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

test/functional/tool_wallet.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python3
2-
# Copyright (c) 2018 The Bitcoin Core developers
2+
# Copyright (c) 2018-2019 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 bitcoin-wallet."""
6+
67
import subprocess
78
import textwrap
89

@@ -37,18 +38,18 @@ def assert_tool_output(self, output, *args):
3738
assert_equal(stdout, output)
3839

3940
def run_test(self):
40-
41+
self.log.info('Testing that various invalid commands raise with specific error messages')
4142
self.assert_raises_tool_error('Invalid command: foo', 'foo')
42-
# `bitcoin-wallet help` is an error. Use `bitcoin-wallet -help`
43+
# `bitcoin-wallet help` raises an error. Use `bitcoin-wallet -help`.
4344
self.assert_raises_tool_error('Invalid command: help', 'help')
4445
self.assert_raises_tool_error('Error: two methods provided (info and create). Only one method should be provided.', 'info', 'create')
4546
self.assert_raises_tool_error('Error parsing command line arguments: Invalid parameter -foo', '-foo')
4647
self.assert_raises_tool_error('Error loading wallet.dat. Is wallet being used by other process?', '-wallet=wallet.dat', 'info')
4748
self.assert_raises_tool_error('Error: no wallet file at nonexistent.dat', '-wallet=nonexistent.dat', 'info')
4849

49-
# stop the node to close the wallet to call info command
50+
# Stop the node to close the wallet to call the info command.
5051
self.stop_node(0)
51-
52+
self.log.info('Calling wallet tool info, testing output')
5253
out = textwrap.dedent('''\
5354
Wallet info
5455
===========
@@ -60,11 +61,13 @@ def run_test(self):
6061
''')
6162
self.assert_tool_output(out, '-wallet=wallet.dat', 'info')
6263

63-
# mutate the wallet to check the info command output changes accordingly
64+
# Mutate wallet to verify info command output changes accordingly.
6465
self.start_node(0)
66+
self.log.info('Generating transaction to mutate wallet')
6567
self.nodes[0].generate(1)
6668
self.stop_node(0)
6769

70+
self.log.info('Calling wallet tool info after generating a transaction, testing output')
6871
out = textwrap.dedent('''\
6972
Wallet info
7073
===========
@@ -76,6 +79,7 @@ def run_test(self):
7679
''')
7780
self.assert_tool_output(out, '-wallet=wallet.dat', 'info')
7881

82+
self.log.info('Calling wallet tool create on an existing wallet, testing output')
7983
out = textwrap.dedent('''\
8084
Topping up keypool...
8185
Wallet info
@@ -88,7 +92,10 @@ def run_test(self):
8892
''')
8993
self.assert_tool_output(out, '-wallet=foo', 'create')
9094

95+
self.log.info('Starting node with arg -wallet=foo')
9196
self.start_node(0, ['-wallet=foo'])
97+
98+
self.log.info('Calling getwalletinfo on a different wallet ("foo"), testing output')
9299
out = self.nodes[0].getwalletinfo()
93100
self.stop_node(0)
94101

0 commit comments

Comments
 (0)