Skip to content

Commit 39fef1d

Browse files
test: Add missing logging info for each test
Add self.log.info(...) calls at the beginning of each test in GetBlocksActivityTest. This improves readability and provides debugging information by logging the purpose of each test upon its correct execution. This is in preparation for the next commit, which adds a new test with log info, and it would look inconsistent without this commit.
1 parent 53ac704 commit 39fef1d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/functional/rpc_getdescriptoractivity.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ def run_test(self):
3333
self.test_no_address(node, wallet)
3434

3535
def test_no_activity(self, node):
36+
self.log.info("Test that no activity is found for an unused address")
3637
_, _, addr_1 = getnewdestination()
3738
result = node.getdescriptoractivity([], [f"addr({addr_1})"], True)
3839
assert_equal(len(result['activity']), 0)
3940

4041
def test_activity_in_block(self, node, wallet):
42+
self.log.info("Test that receive activity is correctly reported in a mined block")
4143
_, spk_1, addr_1 = getnewdestination(address_type='bech32m')
4244
txid = wallet.send_to(from_node=node, scriptPubKey=spk_1, amount=1 * COIN)['txid']
4345
blockhash = self.generate(node, 1)[0]
@@ -67,6 +69,7 @@ def test_activity_in_block(self, node, wallet):
6769

6870

6971
def test_no_mempool_inclusion(self, node, wallet):
72+
self.log.info("Test that mempool transactions are not included when include_mempool argument is False")
7073
_, spk_1, addr_1 = getnewdestination()
7174
wallet.send_to(from_node=node, scriptPubKey=spk_1, amount=1 * COIN)
7275

@@ -81,6 +84,7 @@ def test_no_mempool_inclusion(self, node, wallet):
8184
assert_equal(len(result['activity']), 0)
8285

8386
def test_multiple_addresses(self, node, wallet):
87+
self.log.info("Test querying multiple addresses returns all activity correctly")
8488
_, spk_1, addr_1 = getnewdestination()
8589
_, spk_2, addr_2 = getnewdestination()
8690
wallet.send_to(from_node=node, scriptPubKey=spk_1, amount=1 * COIN)
@@ -113,6 +117,7 @@ def test_multiple_addresses(self, node, wallet):
113117
assert a2['amount'] == 2.0
114118

115119
def test_invalid_blockhash(self, node, wallet):
120+
self.log.info("Test that passing an invalid blockhash raises appropriate RPC error")
116121
self.generate(node, 20) # Generate to get more fees
117122

118123
_, spk_1, addr_1 = getnewdestination()
@@ -125,6 +130,7 @@ def test_invalid_blockhash(self, node, wallet):
125130
node.getdescriptoractivity, [invalid_blockhash], [f"addr({addr_1})"], True)
126131

127132
def test_invalid_descriptor(self, node, wallet):
133+
self.log.info("Test that an invalid descriptor raises the correct RPC error")
128134
blockhash = self.generate(node, 1)[0]
129135
_, _, addr_1 = getnewdestination()
130136

@@ -133,6 +139,7 @@ def test_invalid_descriptor(self, node, wallet):
133139
node.getdescriptoractivity, [blockhash], [f"addrx({addr_1})"], True)
134140

135141
def test_confirmed_and_unconfirmed(self, node, wallet):
142+
self.log.info("Test that both confirmed and unconfirmed transactions are reported correctly")
136143
self.generate(node, 20) # Generate to get more fees
137144

138145
_, spk_1, addr_1 = getnewdestination()
@@ -162,6 +169,7 @@ def test_confirmed_and_unconfirmed(self, node, wallet):
162169

163170
def test_receive_then_spend(self, node, wallet):
164171
"""Also important because this tests multiple blockhashes."""
172+
self.log.info("Test receive and spend activities across different blocks are reported consistently")
165173
self.generate(node, 20) # Generate to get more fees
166174

167175
sent1 = wallet.send_self_transfer(from_node=node)
@@ -189,11 +197,13 @@ def test_receive_then_spend(self, node, wallet):
189197
assert_equal(result, node.getdescriptoractivity(
190198
[blockhash_1, blockhash_2], [wallet.get_descriptor()], True))
191199

200+
self.log.info("Test that duplicated blockhash request does not report duplicated results")
192201
# Test that duplicating a blockhash yields the same result.
193202
assert_equal(result, node.getdescriptoractivity(
194203
[blockhash_1, blockhash_2, blockhash_2], [wallet.get_descriptor()], True))
195204

196205
def test_no_address(self, node, wallet):
206+
self.log.info("Test that activity is still reported for scripts without an associated address")
197207
raw_wallet = MiniWallet(self.nodes[0], mode=MiniWalletMode.RAW_P2PK)
198208
self.generate(raw_wallet, 100)
199209

0 commit comments

Comments
 (0)