Skip to content

Commit 9225de2

Browse files
author
MarcoFalke
committed
Merge #10024: [trivial] Use log.info() instead of print() in remaining functional test cases.
e722777 fix logging in nulldummy and proxy_test (John Newbery) 1f70653 Use log.info() instead of print() in importmulti.py (John Newbery) Tree-SHA512: 0e58f0a970cd93bc1e9d73c6f53ca0671b0c5135cbf92e97d8563bd8a063679bf04f8bde511c275d5f84036aed32f70d3d03679a92688952b46dc97929e0405c
2 parents baae314 + e722777 commit 9225de2

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

qa/rpc-tests/importmulti.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ def run_test (self):
413413

414414
# Importing existing watch only address with new timestamp should replace saved timestamp.
415415
assert_greater_than(timestamp, watchonly_timestamp)
416-
print("Should replace previously saved watch only timestamp.")
416+
self.log.info("Should replace previously saved watch only timestamp.")
417417
result = self.nodes[1].importmulti([{
418418
"scriptPubKey": {
419419
"address": watchonly_address,

qa/rpc-tests/nulldummy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@ def run_test(self):
8181
self.log.info("Test 3: Non-NULLDUMMY base transactions should be accepted in a block before activation [431]")
8282
self.block_submit(self.nodes[0], [test2tx], False, True)
8383

84-
self.log.info ("Test 4: Non-NULLDUMMY base multisig transaction is invalid after activation")
84+
self.log.info("Test 4: Non-NULLDUMMY base multisig transaction is invalid after activation")
8585
test4tx = self.create_transaction(self.nodes[0], test2tx.hash, self.address, 46)
8686
test6txs=[CTransaction(test4tx)]
8787
trueDummy(test4tx)
8888
assert_raises_jsonrpc(-26, NULLDUMMY_ERROR, self.nodes[0].sendrawtransaction, bytes_to_hex_str(test4tx.serialize_with_witness()), True)
8989
self.block_submit(self.nodes[0], [test4tx])
9090

91-
print ("Test 5: Non-NULLDUMMY P2WSH multisig transaction invalid after activation")
91+
self.log.info("Test 5: Non-NULLDUMMY P2WSH multisig transaction invalid after activation")
9292
test5tx = self.create_transaction(self.nodes[0], txid3, self.wit_address, 48)
9393
test6txs.append(CTransaction(test5tx))
9494
test5tx.wit.vtxinwit[0].scriptWitness.stack[0] = b'\x01'

qa/rpc-tests/proxy_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def __init__(self):
4949
self.num_nodes = 4
5050
self.setup_clean_chain = False
5151

52+
def setup_nodes(self):
5253
self.have_ipv6 = test_ipv6_local()
5354
# Create two proxies on different ports
5455
# ... one unauthenticated
@@ -69,7 +70,7 @@ def __init__(self):
6970
self.conf3.unauth = True
7071
self.conf3.auth = True
7172
else:
72-
print("Warning: testing without local IPv6 support")
73+
self.log.warning("Testing without local IPv6 support")
7374

7475
self.serv1 = Socks5Server(self.conf1)
7576
self.serv1.start()
@@ -79,7 +80,6 @@ def __init__(self):
7980
self.serv3 = Socks5Server(self.conf3)
8081
self.serv3.start()
8182

82-
def setup_nodes(self):
8383
# Note: proxies are not used to connect to local nodes
8484
# this is because the proxy to use is based on CService.GetNetwork(), which return NET_UNROUTABLE for localhost
8585
args = [

qa/rpc-tests/test_framework/socks5.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
import socket, threading, queue
88
import traceback, sys
9+
import logging
10+
11+
logger = logging.getLogger("TestFramework.socks5")
912

1013
### Protocol constants
1114
class Command:
@@ -112,10 +115,10 @@ def handle(self):
112115

113116
cmdin = Socks5Command(cmd, atyp, addr, port, username, password)
114117
self.serv.queue.put(cmdin)
115-
print('Proxy: ', cmdin)
118+
logger.info('Proxy: %s', cmdin)
116119
# Fall through to disconnect
117120
except Exception as e:
118-
traceback.print_exc(file=sys.stderr)
121+
logger.exception("socks5 request handling failed.")
119122
self.serv.queue.put(e)
120123
finally:
121124
self.conn.close()

0 commit comments

Comments
 (0)