|
7 | 7 | import configparser
|
8 | 8 | from enum import Enum
|
9 | 9 | import logging
|
10 |
| -import optparse |
| 10 | +import argparse |
11 | 11 | import os
|
12 | 12 | import pdb
|
13 | 13 | import shutil
|
@@ -96,31 +96,31 @@ def __init__(self):
|
96 | 96 | def main(self):
|
97 | 97 | """Main function. This should not be overridden by the subclass test scripts."""
|
98 | 98 |
|
99 |
| - parser = optparse.OptionParser(usage="%prog [options]") |
100 |
| - parser.add_option("--nocleanup", dest="nocleanup", default=False, action="store_true", |
101 |
| - help="Leave bitcoinds and test.* datadir on exit or error") |
102 |
| - parser.add_option("--noshutdown", dest="noshutdown", default=False, action="store_true", |
103 |
| - help="Don't stop bitcoinds after the test execution") |
104 |
| - parser.add_option("--cachedir", dest="cachedir", default=os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + "/../../cache"), |
105 |
| - help="Directory for caching pregenerated datadirs (default: %default)") |
106 |
| - parser.add_option("--tmpdir", dest="tmpdir", help="Root directory for datadirs") |
107 |
| - parser.add_option("-l", "--loglevel", dest="loglevel", default="INFO", |
108 |
| - help="log events at this level and higher to the console. Can be set to DEBUG, INFO, WARNING, ERROR or CRITICAL. Passing --loglevel DEBUG will output all logs to console. Note that logs at all levels are always written to the test_framework.log file in the temporary test directory.") |
109 |
| - parser.add_option("--tracerpc", dest="trace_rpc", default=False, action="store_true", |
110 |
| - help="Print out all RPC calls as they are made") |
111 |
| - parser.add_option("--portseed", dest="port_seed", default=os.getpid(), type='int', |
112 |
| - help="The seed to use for assigning port numbers (default: current process id)") |
113 |
| - parser.add_option("--coveragedir", dest="coveragedir", |
114 |
| - help="Write tested RPC commands into this directory") |
115 |
| - parser.add_option("--configfile", dest="configfile", |
116 |
| - default=os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + "/../../config.ini"), |
117 |
| - help="Location of the test framework config file (default: %default)") |
118 |
| - parser.add_option("--pdbonfailure", dest="pdbonfailure", default=False, action="store_true", |
119 |
| - help="Attach a python debugger if test fails") |
120 |
| - parser.add_option("--usecli", dest="usecli", default=False, action="store_true", |
121 |
| - help="use bitcoin-cli instead of RPC for all commands") |
| 99 | + parser = argparse.ArgumentParser(usage="%(prog)s [options]") |
| 100 | + parser.add_argument("--nocleanup", dest="nocleanup", default=False, action="store_true", |
| 101 | + help="Leave bitcoinds and test.* datadir on exit or error") |
| 102 | + parser.add_argument("--noshutdown", dest="noshutdown", default=False, action="store_true", |
| 103 | + help="Don't stop bitcoinds after the test execution") |
| 104 | + parser.add_argument("--cachedir", dest="cachedir", default=os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + "/../../cache"), |
| 105 | + help="Directory for caching pregenerated datadirs (default: %(default)s)") |
| 106 | + parser.add_argument("--tmpdir", dest="tmpdir", help="Root directory for datadirs") |
| 107 | + parser.add_argument("-l", "--loglevel", dest="loglevel", default="INFO", |
| 108 | + help="log events at this level and higher to the console. Can be set to DEBUG, INFO, WARNING, ERROR or CRITICAL. Passing --loglevel DEBUG will output all logs to console. Note that logs at all levels are always written to the test_framework.log file in the temporary test directory.") |
| 109 | + parser.add_argument("--tracerpc", dest="trace_rpc", default=False, action="store_true", |
| 110 | + help="Print out all RPC calls as they are made") |
| 111 | + parser.add_argument("--portseed", dest="port_seed", default=os.getpid(), type=int, |
| 112 | + help="The seed to use for assigning port numbers (default: current process id)") |
| 113 | + parser.add_argument("--coveragedir", dest="coveragedir", |
| 114 | + help="Write tested RPC commands into this directory") |
| 115 | + parser.add_argument("--configfile", dest="configfile", |
| 116 | + default=os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + "/../../config.ini"), |
| 117 | + help="Location of the test framework config file (default: %(default)s)") |
| 118 | + parser.add_argument("--pdbonfailure", dest="pdbonfailure", default=False, action="store_true", |
| 119 | + help="Attach a python debugger if test fails") |
| 120 | + parser.add_argument("--usecli", dest="usecli", default=False, action="store_true", |
| 121 | + help="use bitcoin-cli instead of RPC for all commands") |
122 | 122 | self.add_options(parser)
|
123 |
| - (self.options, self.args) = parser.parse_args() |
| 123 | + self.options = parser.parse_args() |
124 | 124 |
|
125 | 125 | PortSeed.n = self.options.port_seed
|
126 | 126 |
|
|
0 commit comments