test: re-enable CLI test support by using EncodeDecimal in json.dumps() #17705

pull fanquake wants to merge 1 commits into bitcoin:master from fanquake:test_framework_json_dumps changing 14 files +7 −13
  1. fanquake commented at 8:17 PM on December 9, 2019: member

    As mentioned in #17675 (comment).

  2. test: re-enable CLI test support by using EncodeDecimal in json.dumps()
    As mentioned in
    https://github.com/bitcoin/bitcoin/pull/17675#issuecomment-563188648
    b6f9e3576a
  3. fanquake added the label Tests on Dec 9, 2019
  4. practicalswift commented at 8:23 PM on December 9, 2019: contributor

    Thanks for following up on this!

    ACK b6f9e3576a1ea18572e4803aeb3f39330f0cb759 assuming Travis is happy too -- diff looks correct :)

  5. in test/functional/test_framework/util.py:196 in b6f9e3576a
     189 | @@ -190,6 +190,11 @@ def check_json_precision():
     190 |      if satoshis != 2000000000000003:
     191 |          raise RuntimeError("JSON encode/decode loses precision")
     192 |  
     193 | +def EncodeDecimal(o):
     194 | +    if isinstance(o, Decimal):
     195 | +        return str(o)
     196 | +    raise TypeError(repr(o) + " is not JSON serializable")
    


    MarcoFalke commented at 8:24 PM on December 9, 2019:

    Any reason why this is duplicated from the identical function in authproxy?


    fanquake commented at 8:27 PM on December 9, 2019:

    There were include issues running tests directly when I moved the authproxy usage into util. I can take another look.


    MarcoFalke commented at 8:30 PM on December 9, 2019:

    ok, you may leave it as is

  6. MarcoFalke approved
  7. MarcoFalke commented at 8:31 PM on December 9, 2019: member

    ACK b6f9e35 assuming Travis is happy too -- diff looks correct :)

    travis doesn't run with --usecli

  8. practicalswift commented at 8:34 PM on December 9, 2019: contributor

    @MarcoFalke I think it does for wallet_multiwallet.py, wallet_createwallet.py, wallet_watchonly.py and rpc_deriveaddresses.py? :)

  9. MarcoFalke commented at 8:44 PM on December 9, 2019: member

    @MarcoFalke I think it does for wallet_multiwallet.py, wallet_createwallet.py, wallet_watchonly.py and rpc_deriveaddresses.py? :)

    Yeah, but none of these files are touched in this pull

  10. practicalswift commented at 9:30 PM on December 9, 2019: contributor

    @MarcoFalke They all use arg_to_cli which is touched by this pull, no? :)

  11. fanquake referenced this in commit 3f1966ead6 on Dec 12, 2019
  12. fanquake merged this on Dec 12, 2019
  13. fanquake closed this on Dec 12, 2019

  14. fanquake deleted the branch on Dec 12, 2019
  15. sidhujag referenced this in commit 62e261894a on Dec 12, 2019
  16. jasonbcox referenced this in commit 47048ca9d3 on Nov 10, 2020
  17. sidhujag referenced this in commit c2abcf8957 on Nov 10, 2020
  18. DrahtBot locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-16 18:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me