3636
3737
3838def build_command_line_parser ():
39- parser = argparse .ArgumentParser (description = "Runs GEOS integrated tests" )
39+ parser = argparse .ArgumentParser ( description = "Runs GEOS integrated tests" )
4040
41- parser .add_argument ("geos_bin_dir" , type = str , help = "GEOS binary directory." )
41+ parser .add_argument ( "geos_bin_dir" , type = str , help = "GEOS binary directory." )
4242
43- parser .add_argument ("-w" , "--workingDir" , type = str , help = "Initial working directory" )
43+ parser .add_argument ( "-w" , "--workingDir" , type = str , help = "Initial working directory" )
4444
45- action_names = ',' .join (action_options .keys ())
46- parser .add_argument ("-a" , "--action" , type = str , default = "run" , help = f"Test actions options ({ action_names } )" )
45+ action_names = ',' .join ( action_options .keys () )
46+ parser .add_argument ( "-a" , "--action" , type = str , default = "run" , help = f"Test actions options ({ action_names } )" )
4747
48- check_names = ',' .join (check_options .keys ())
49- parser .add_argument ("-c" , "--check" , type = str , default = "all" , help = f"Test check options ({ check_names } )" )
48+ check_names = ',' .join ( check_options .keys () )
49+ parser .add_argument ( "-c" , "--check" , type = str , default = "all" , help = f"Test check options ({ check_names } )" )
5050
51- verbosity_names = ',' .join (verbose_options .keys ())
52- parser .add_argument ("-v" , "--verbose" , type = str , default = "info" , help = f"Log verbosity options ({ verbosity_names } )" )
51+ verbosity_names = ',' .join ( verbose_options .keys () )
52+ parser .add_argument ( "-v" ,
53+ "--verbose" ,
54+ type = str ,
55+ default = "info" ,
56+ help = f"Log verbosity options ({ verbosity_names } )" )
5357
54- parser .add_argument ("-d" , "--detail" , action = "store_true" , default = False , help = "Show detailed action/check options" )
58+ parser .add_argument ( "-d" ,
59+ "--detail" ,
60+ action = "store_true" ,
61+ default = False ,
62+ help = "Show detailed action/check options" )
5563
56- parser .add_argument ("-i" , "--info" , action = "store_true" , default = False , help = "Info on various topics" )
64+ parser .add_argument ( "-i" , "--info" , action = "store_true" , default = False , help = "Info on various topics" )
5765
58- parser .add_argument ("-r" ,
59- "--restartCheckOverrides" ,
60- nargs = '+' ,
61- action = 'append' ,
62- help = 'Restart check parameter override (name value)' ,
63- default = [])
66+ parser .add_argument ( "-r" ,
67+ "--restartCheckOverrides" ,
68+ nargs = '+' ,
69+ action = 'append' ,
70+ help = 'Restart check parameter override (name value)' ,
71+ default = [] )
6472
65- parser .add_argument ("--salloc" ,
66- default = True ,
67- help = "Used by the chaosM machine to first allocate nodes with salloc, before running the tests" )
73+ parser .add_argument (
74+ "--salloc" ,
75+ default = True ,
76+ help = "Used by the chaosM machine to first allocate nodes with salloc, before running the tests" )
6877
6978 parser .add_argument (
7079 "--sallocoptions" ,
7180 type = str ,
7281 default = "" ,
73- help = "Used to override all command-line options for salloc. No other options with be used or added." )
82+ help = "Used to override all command-line options for salloc. No other options with be used or added." )
7483
75- parser .add_argument ("--ats" , nargs = '+' , default = [], action = "append" , help = "pass arguments to ats" )
84+ parser .add_argument ( "--ats" , nargs = '+' , default = [], action = "append" , help = "pass arguments to ats" )
7685
77- parser .add_argument ("--machine" , default = None , help = "name of the machine" )
86+ parser .add_argument ( "--machine" , default = None , help = "name of the machine" )
7887
79- parser .add_argument ("--machine-dir" , default = None , help = "Search path for machine definitions" )
88+ parser .add_argument ( "--machine-dir" , default = None , help = "Search path for machine definitions" )
8089
81- parser .add_argument ("-l" , "--logs" , type = str , default = None )
90+ parser .add_argument ( "-l" , "--logs" , type = str , default = None )
8291
8392 parser .add_argument (
8493 "--failIfTestsFail" ,
@@ -87,14 +96,14 @@ def build_command_line_parser():
8796 help = "geos_ats normally exits with 0. This will cause it to exit with an error code if there was a failed test."
8897 )
8998
90- parser .add_argument ("-n" , "-N" , "--numNodes" , type = int , default = "2" )
99+ parser .add_argument ( "-n" , "-N" , "--numNodes" , type = int , default = "2" )
91100
92- parser .add_argument ("ats_targets" , type = str , nargs = '*' , help = "ats files or directories." )
101+ parser .add_argument ( "ats_targets" , type = str , nargs = '*' , help = "ats files or directories." )
93102
94103 return parser
95104
96105
97- def parse_command_line_arguments (args ):
106+ def parse_command_line_arguments ( args ):
98107 parser = build_command_line_parser ()
99108 options , unkown_args = parser .parse_known_args ()
100109 exit_flag = False
@@ -103,7 +112,7 @@ def parse_command_line_arguments(args):
103112 check = options .check
104113 if check not in check_options :
105114 print (
106- f"Selected check option ({ check } ) not recognized. Try running with --help/--details for more information" )
115+ f"Selected check option ({ check } ) not recognized. Try running with --help/--details for more information" )
107116 exit_flag = True
108117
109118 action = options .action
@@ -115,15 +124,15 @@ def parse_command_line_arguments(args):
115124
116125 verbose = options .verbose
117126 if verbose not in verbose_options :
118- print (f"Selected verbose option ({ verbose } ) not recognized" )
127+ print ( f"Selected verbose option ({ verbose } ) not recognized" )
119128 exit_flag = True
120129
121130 # Print detailed information
122131 if options .detail :
123- for option_type , details in zip ([ 'action' , 'check' ], [action_options , check_options ] ):
124- print (f'\n Available { option_type } options:' )
132+ for option_type , details in zip ( [ 'action' , 'check' ], [ action_options , check_options ] ):
133+ print ( f'\n Available { option_type } options:' )
125134 for k , v in details .items ():
126- print (f' { k } : { v } ' )
135+ print ( f' { k } : { v } ' )
127136 exit_flag = True
128137
129138 if exit_flag :
@@ -132,20 +141,20 @@ def parse_command_line_arguments(args):
132141 return options
133142
134143
135- def patch_parser (parser ):
144+ def patch_parser ( parser ):
136145
137- def add_option_patch (* xargs , ** kwargs ):
146+ def add_option_patch ( * xargs , ** kwargs ):
138147 """
139148 Convert type string to actual type instance
140149 """
141- tmp = kwargs .get ('type' , str )
142- type_map = {'string' : str }
143- if isinstance (tmp , str ):
150+ tmp = kwargs .get ( 'type' , str )
151+ type_map = { 'string' : str }
152+ if isinstance ( tmp , str ):
144153 if tmp in type_map :
145- tmp = type_map [tmp ]
154+ tmp = type_map [ tmp ]
146155 else :
147- tmp = locate (tmp )
148- kwargs ['type' ] = tmp
149- parser .add_argument (* xargs , ** kwargs )
156+ tmp = locate ( tmp )
157+ kwargs [ 'type' ] = tmp
158+ parser .add_argument ( * xargs , ** kwargs )
150159
151160 parser .add_option = add_option_patch
0 commit comments