tests: Port usage of deprecated optparse module to argparse module #13944

pull Kvaciral wants to merge 1 commits into bitcoin:master from Kvaciral:argparse_port changing 5 files +41 −41
  1. Kvaciral commented at 9:41 PM on August 11, 2018: contributor

    The optparse module is deprecated since Python 2.7/3.2 . Recommend usage of the argparse module which improves upon optparse.

  2. laanwj added the label Tests on Aug 11, 2018
  3. in test/functional/example_test.py:73 in 24ae7d08b4 outdated
      69 | @@ -70,7 +70,7 @@ def custom_function():
      70 |  class ExampleTest(BitcoinTestFramework):
      71 |      # Each functional test is a subclass of the BitcoinTestFramework class.
      72 |  
      73 | -    # Override the set_test_params(), add_options(), setup_chain(), setup_network()
      74 | +    # Override the set_test_params(), add_arguments(), setup_chain(), setup_network()
    


    MarcoFalke commented at 9:54 PM on August 11, 2018:

    All of our arguments are options, so our name of this method can be left untouched.

  4. laanwj commented at 10:23 PM on August 11, 2018: member

    utACK 5654efb187d24eb29a343c720e3937b01457c8b7

  5. Ported usage of deprecated optparse module to argparse module 5654efb187
  6. promag commented at 12:04 AM on August 12, 2018: member

    utACK 5654efb.

  7. Kvaciral renamed this:
    test: Port usage of deprecated optparse module to argparse module
    tests: Port usage of deprecated optparse module to argparse module
    on Aug 12, 2018
  8. in test/functional/test_framework/test_framework.py:123 in 5654efb187
     141 | +        parser.add_argument("--pdbonfailure", dest="pdbonfailure", default=False, action="store_true",
     142 | +                            help="Attach a python debugger if test fails")
     143 | +        parser.add_argument("--usecli", dest="usecli", default=False, action="store_true",
     144 | +                            help="use bitcoin-cli instead of RPC for all commands")
     145 |          self.add_options(parser)
     146 | -        (self.options, self.args) = parser.parse_args()
    


    domob1812 commented at 9:34 AM on August 12, 2018:

    I assume that no existing code relies on self.args (as otherwise you would see test failures)?


    laanwj commented at 9:43 AM on August 12, 2018:

    indeed, none of the code uses that as @MarcoFalke mentioned above, all the command-line arguments are options

  9. domob1812 approved
  10. domob1812 commented at 9:34 AM on August 12, 2018: contributor

    utACK 5654efb187d24eb29a343c720e3937b01457c8b7

  11. fanquake commented at 9:45 AM on August 12, 2018: member

    utACK 5654efb

  12. laanwj merged this on Aug 12, 2018
  13. laanwj closed this on Aug 12, 2018

  14. laanwj referenced this in commit 0df7a6c13e on Aug 12, 2018
  15. UdjinM6 referenced this in commit ad8df421ad on Jul 4, 2021
  16. UdjinM6 referenced this in commit 93b8fe2452 on Jul 6, 2021
  17. UdjinM6 referenced this in commit aaf5235b78 on Jul 6, 2021
  18. MarcoFalke locked this on Sep 8, 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-28 06:15 UTC

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