mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-09 10:43:19 -05:00
Merge #17705: test: re-enable CLI test support by using EncodeDecimal in json.dumps()
b6f9e3576a
test: re-enable CLI test support by using EncodeDecimal in json.dumps() (fanquake) Pull request description: As mentioned in https://github.com/bitcoin/bitcoin/pull/17675#issuecomment-563188648. ACKs for top commit: practicalswift: ACKb6f9e3576a
assuming Travis is happy too -- diff looks correct :) MarcoFalke: > ACKb6f9e35
assuming Travis is happy too -- diff looks correct :) Tree-SHA512: 79fa535cc1756c8ee610a3d6a316a1c4f036797d6990a5620e44985393a2e52f78450f8e0021d0a148c08705fd1ba765508464a365f9030ae0d2cacbd7a93e19
This commit is contained in:
commit
3f1966ead6
14 changed files with 7 additions and 13 deletions
|
@ -72,7 +72,6 @@ class SegWitTest(BitcoinTestFramework):
|
||||||
"-addresstype=legacy",
|
"-addresstype=legacy",
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
self.supports_cli = False
|
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
|
|
@ -19,7 +19,6 @@ class MempoolPackagesTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
self.extra_args = [["-maxorphantx=1000"]]
|
self.extra_args = [["-maxorphantx=1000"]]
|
||||||
self.supports_cli = False
|
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
|
|
@ -27,7 +27,6 @@ class MempoolPackagesTest(BitcoinTestFramework):
|
||||||
["-maxorphantx=1000"],
|
["-maxorphantx=1000"],
|
||||||
["-maxorphantx=1000", "-limitancestorcount={}".format(MAX_ANCESTORS_CUSTOM)],
|
["-maxorphantx=1000", "-limitancestorcount={}".format(MAX_ANCESTORS_CUSTOM)],
|
||||||
]
|
]
|
||||||
self.supports_cli = False
|
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
|
|
@ -31,7 +31,6 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||||
# This test isn't testing tx relay. Set whitelist on the peers for
|
# This test isn't testing tx relay. Set whitelist on the peers for
|
||||||
# instant tx relay.
|
# instant tx relay.
|
||||||
self.extra_args = [['-whitelist=127.0.0.1']] * self.num_nodes
|
self.extra_args = [['-whitelist=127.0.0.1']] * self.num_nodes
|
||||||
self.supports_cli = False
|
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
|
|
@ -15,7 +15,6 @@ class SignRawTransactionsTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
self.supports_cli = False
|
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
|
|
@ -14,7 +14,6 @@ class MerkleBlockTest(BitcoinTestFramework):
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
# Nodes 0/1 are "wallet" nodes, Nodes 2/3 are used for testing
|
# Nodes 0/1 are "wallet" nodes, Nodes 2/3 are used for testing
|
||||||
self.extra_args = [[], [], [], ["-txindex"]]
|
self.extra_args = [[], [], [], ["-txindex"]]
|
||||||
self.supports_cli = False
|
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
|
|
@ -30,6 +30,7 @@ from .util import (
|
||||||
rpc_url,
|
rpc_url,
|
||||||
wait_until,
|
wait_until,
|
||||||
p2p_port,
|
p2p_port,
|
||||||
|
EncodeDecimal,
|
||||||
)
|
)
|
||||||
|
|
||||||
BITCOIND_PROC_WAIT_TIMEOUT = 60
|
BITCOIND_PROC_WAIT_TIMEOUT = 60
|
||||||
|
@ -489,7 +490,7 @@ def arg_to_cli(arg):
|
||||||
if isinstance(arg, bool):
|
if isinstance(arg, bool):
|
||||||
return str(arg).lower()
|
return str(arg).lower()
|
||||||
elif isinstance(arg, dict) or isinstance(arg, list):
|
elif isinstance(arg, dict) or isinstance(arg, list):
|
||||||
return json.dumps(arg)
|
return json.dumps(arg, default=EncodeDecimal)
|
||||||
else:
|
else:
|
||||||
return str(arg)
|
return str(arg)
|
||||||
|
|
||||||
|
|
|
@ -190,6 +190,11 @@ def check_json_precision():
|
||||||
if satoshis != 2000000000000003:
|
if satoshis != 2000000000000003:
|
||||||
raise RuntimeError("JSON encode/decode loses precision")
|
raise RuntimeError("JSON encode/decode loses precision")
|
||||||
|
|
||||||
|
def EncodeDecimal(o):
|
||||||
|
if isinstance(o, Decimal):
|
||||||
|
return str(o)
|
||||||
|
raise TypeError(repr(o) + " is not JSON serializable")
|
||||||
|
|
||||||
def count_bytes(hex_string):
|
def count_bytes(hex_string):
|
||||||
return len(bytearray.fromhex(hex_string))
|
return len(bytearray.fromhex(hex_string))
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ class AbandonConflictTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
self.extra_args = [["-minrelaytxfee=0.00001"], []]
|
self.extra_args = [["-minrelaytxfee=0.00001"], []]
|
||||||
self.supports_cli = False
|
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
|
|
@ -54,7 +54,6 @@ class WalletTest(BitcoinTestFramework):
|
||||||
['-limitdescendantcount=3'], # Limit mempool descendants as a hack to have wallet txs rejected from the mempool
|
['-limitdescendantcount=3'], # Limit mempool descendants as a hack to have wallet txs rejected from the mempool
|
||||||
[],
|
[],
|
||||||
]
|
]
|
||||||
self.supports_cli = False
|
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
|
|
@ -40,7 +40,6 @@ class BumpFeeTest(BitcoinTestFramework):
|
||||||
"-deprecatedrpc=totalFee",
|
"-deprecatedrpc=totalFee",
|
||||||
"-addresstype=bech32",
|
"-addresstype=bech32",
|
||||||
] for i in range(self.num_nodes)]
|
] for i in range(self.num_nodes)]
|
||||||
self.supports_cli = False
|
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
|
|
@ -16,7 +16,6 @@ class BumpFeeWithTotalFeeArgumentDeprecationTest(BitcoinTestFramework):
|
||||||
"-walletrbf={}".format(i),
|
"-walletrbf={}".format(i),
|
||||||
"-mintxfee=0.00002",
|
"-mintxfee=0.00002",
|
||||||
] for i in range(self.num_nodes)]
|
] for i in range(self.num_nodes)]
|
||||||
self.supports_cli = False
|
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
|
|
@ -19,7 +19,6 @@ class ListSinceBlockTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 4
|
self.num_nodes = 4
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.supports_cli = False
|
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
|
|
@ -27,7 +27,6 @@ from test_framework.util import (
|
||||||
class ReorgsRestoreTest(BitcoinTestFramework):
|
class ReorgsRestoreTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 3
|
self.num_nodes = 3
|
||||||
self.supports_cli = False
|
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
|
Loading…
Add table
Reference in a new issue