diff options
author | fanquake <fanquake@gmail.com> | 2019-12-09 15:02:50 -0500 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2019-12-09 15:14:20 -0500 |
commit | b6f9e3576a1ea18572e4803aeb3f39330f0cb759 (patch) | |
tree | a37a8044b58bd02b1609d7ef86b36bfbe5740980 /test/functional | |
parent | 347dd76ec87ddbd1913dc7b57729793ac3bb1ab9 (diff) |
test: re-enable CLI test support by using EncodeDecimal in json.dumps()
As mentioned in
https://github.com/bitcoin/bitcoin/pull/17675#issuecomment-563188648
Diffstat (limited to 'test/functional')
-rwxr-xr-x | test/functional/feature_segwit.py | 1 | ||||
-rwxr-xr-x | test/functional/mempool_package_onemore.py | 1 | ||||
-rwxr-xr-x | test/functional/mempool_packages.py | 1 | ||||
-rwxr-xr-x | test/functional/rpc_fundrawtransaction.py | 1 | ||||
-rwxr-xr-x | test/functional/rpc_signrawtransaction.py | 1 | ||||
-rwxr-xr-x | test/functional/rpc_txoutproof.py | 1 | ||||
-rwxr-xr-x | test/functional/test_framework/test_node.py | 3 | ||||
-rw-r--r-- | test/functional/test_framework/util.py | 5 | ||||
-rwxr-xr-x | test/functional/wallet_abandonconflict.py | 1 | ||||
-rwxr-xr-x | test/functional/wallet_balance.py | 1 | ||||
-rwxr-xr-x | test/functional/wallet_bumpfee.py | 1 | ||||
-rwxr-xr-x | test/functional/wallet_bumpfee_totalfee_deprecation.py | 1 | ||||
-rwxr-xr-x | test/functional/wallet_listsinceblock.py | 1 | ||||
-rwxr-xr-x | test/functional/wallet_reorgsrestore.py | 1 |
14 files changed, 7 insertions, 13 deletions
diff --git a/test/functional/feature_segwit.py b/test/functional/feature_segwit.py index bf3c56228e..82c7e55245 100755 --- a/test/functional/feature_segwit.py +++ b/test/functional/feature_segwit.py @@ -72,7 +72,6 @@ class SegWitTest(BitcoinTestFramework): "-addresstype=legacy", ], ] - self.supports_cli = False def skip_test_if_missing_module(self): self.skip_if_no_wallet() diff --git a/test/functional/mempool_package_onemore.py b/test/functional/mempool_package_onemore.py index 7ff8c12cc9..0739d7e29b 100755 --- a/test/functional/mempool_package_onemore.py +++ b/test/functional/mempool_package_onemore.py @@ -19,7 +19,6 @@ class MempoolPackagesTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 self.extra_args = [["-maxorphantx=1000"]] - self.supports_cli = False def skip_test_if_missing_module(self): self.skip_if_no_wallet() diff --git a/test/functional/mempool_packages.py b/test/functional/mempool_packages.py index d6498f18a7..7014105d88 100755 --- a/test/functional/mempool_packages.py +++ b/test/functional/mempool_packages.py @@ -27,7 +27,6 @@ class MempoolPackagesTest(BitcoinTestFramework): ["-maxorphantx=1000"], ["-maxorphantx=1000", "-limitancestorcount={}".format(MAX_ANCESTORS_CUSTOM)], ] - self.supports_cli = False def skip_test_if_missing_module(self): self.skip_if_no_wallet() diff --git a/test/functional/rpc_fundrawtransaction.py b/test/functional/rpc_fundrawtransaction.py index 3ae42cb1f4..6f1ae0d3ba 100755 --- a/test/functional/rpc_fundrawtransaction.py +++ b/test/functional/rpc_fundrawtransaction.py @@ -31,7 +31,6 @@ class RawTransactionsTest(BitcoinTestFramework): # This test isn't testing tx relay. Set whitelist on the peers for # instant tx relay. self.extra_args = [['-whitelist=127.0.0.1']] * self.num_nodes - self.supports_cli = False def skip_test_if_missing_module(self): self.skip_if_no_wallet() diff --git a/test/functional/rpc_signrawtransaction.py b/test/functional/rpc_signrawtransaction.py index 9fd44762d8..780758e219 100755 --- a/test/functional/rpc_signrawtransaction.py +++ b/test/functional/rpc_signrawtransaction.py @@ -15,7 +15,6 @@ class SignRawTransactionsTest(BitcoinTestFramework): def set_test_params(self): self.setup_clean_chain = True self.num_nodes = 2 - self.supports_cli = False def skip_test_if_missing_module(self): self.skip_if_no_wallet() diff --git a/test/functional/rpc_txoutproof.py b/test/functional/rpc_txoutproof.py index 9f15971171..8913b8698d 100755 --- a/test/functional/rpc_txoutproof.py +++ b/test/functional/rpc_txoutproof.py @@ -14,7 +14,6 @@ class MerkleBlockTest(BitcoinTestFramework): self.setup_clean_chain = True # Nodes 0/1 are "wallet" nodes, Nodes 2/3 are used for testing self.extra_args = [[], [], [], ["-txindex"]] - self.supports_cli = False def skip_test_if_missing_module(self): self.skip_if_no_wallet() diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index 1c9628264f..604c573940 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -30,6 +30,7 @@ from .util import ( rpc_url, wait_until, p2p_port, + EncodeDecimal, ) BITCOIND_PROC_WAIT_TIMEOUT = 60 @@ -480,7 +481,7 @@ def arg_to_cli(arg): if isinstance(arg, bool): return str(arg).lower() elif isinstance(arg, dict) or isinstance(arg, list): - return json.dumps(arg) + return json.dumps(arg, default=EncodeDecimal) else: return str(arg) diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index 4d7967273a..5bb73aee7e 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -190,6 +190,11 @@ def check_json_precision(): if satoshis != 2000000000000003: 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): return len(bytearray.fromhex(hex_string)) diff --git a/test/functional/wallet_abandonconflict.py b/test/functional/wallet_abandonconflict.py index 3a81f14b00..1122daaf83 100755 --- a/test/functional/wallet_abandonconflict.py +++ b/test/functional/wallet_abandonconflict.py @@ -26,7 +26,6 @@ class AbandonConflictTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 2 self.extra_args = [["-minrelaytxfee=0.00001"], []] - self.supports_cli = False def skip_test_if_missing_module(self): self.skip_if_no_wallet() diff --git a/test/functional/wallet_balance.py b/test/functional/wallet_balance.py index e0ee33ccdb..a5f9a047ed 100755 --- a/test/functional/wallet_balance.py +++ b/test/functional/wallet_balance.py @@ -54,7 +54,6 @@ class WalletTest(BitcoinTestFramework): ['-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): self.skip_if_no_wallet() diff --git a/test/functional/wallet_bumpfee.py b/test/functional/wallet_bumpfee.py index 7eb756df51..0c08655833 100755 --- a/test/functional/wallet_bumpfee.py +++ b/test/functional/wallet_bumpfee.py @@ -40,7 +40,6 @@ class BumpFeeTest(BitcoinTestFramework): "-deprecatedrpc=totalFee", "-addresstype=bech32", ] for i in range(self.num_nodes)] - self.supports_cli = False def skip_test_if_missing_module(self): self.skip_if_no_wallet() diff --git a/test/functional/wallet_bumpfee_totalfee_deprecation.py b/test/functional/wallet_bumpfee_totalfee_deprecation.py index af6e7b67b3..b8e097c32e 100755 --- a/test/functional/wallet_bumpfee_totalfee_deprecation.py +++ b/test/functional/wallet_bumpfee_totalfee_deprecation.py @@ -16,7 +16,6 @@ class BumpFeeWithTotalFeeArgumentDeprecationTest(BitcoinTestFramework): "-walletrbf={}".format(i), "-mintxfee=0.00002", ] for i in range(self.num_nodes)] - self.supports_cli = False def skip_test_if_missing_module(self): self.skip_if_no_wallet() diff --git a/test/functional/wallet_listsinceblock.py b/test/functional/wallet_listsinceblock.py index dc69cedc44..6f248c9bd3 100755 --- a/test/functional/wallet_listsinceblock.py +++ b/test/functional/wallet_listsinceblock.py @@ -19,7 +19,6 @@ class ListSinceBlockTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 4 self.setup_clean_chain = True - self.supports_cli = False def skip_test_if_missing_module(self): self.skip_if_no_wallet() diff --git a/test/functional/wallet_reorgsrestore.py b/test/functional/wallet_reorgsrestore.py index 0797785560..f48018e9fb 100755 --- a/test/functional/wallet_reorgsrestore.py +++ b/test/functional/wallet_reorgsrestore.py @@ -27,7 +27,6 @@ from test_framework.util import ( class ReorgsRestoreTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 3 - self.supports_cli = False def skip_test_if_missing_module(self): self.skip_if_no_wallet() |