Changeset ac516aa in mod_gnutls


Ignore:
Timestamp:
Dec 31, 2019, 11:13:34 AM (11 months ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
asyncio, master, proxy-ticket
Children:
b457e67
Parents:
079859e
Message:

runtest.py: Split actions after argument parsing into a main function

This will make handling log files easier.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/runtest.py

    r079859e rac516aa  
    7878
    7979
    80 if __name__ == "__main__":
    81     import argparse
    82     parser = argparse.ArgumentParser(
    83         description='Run a mod_gnutls server test')
    84     parser.add_argument('--test-number', type=int,
    85                         required=True, help='load YAML test configuration')
    86     parser.add_argument('--log-connection', type=str, default=None,
    87                         help='write connection log to this file')
    88     parser.add_argument('--log-responses', type=str, default=None,
    89                         help='write HTTP responses to this file')
    90 
    91     # enable bash completion if argcomplete is available
    92     try:
    93         import argcomplete
    94         argcomplete.autocomplete(parser)
    95     except ImportError:
    96         pass
    97 
    98     args = parser.parse_args()
    99 
     80def main(args):
    10081    # The Automake environment always provides srcdir, the default is
    10182    # for manual use.
     
    222203                output_file = stack.enter_context(open(args.log_responses, 'r'))
    223204            plugin.post_check(conn_log=log_file, response_log=output_file)
     205
     206
     207
     208if __name__ == "__main__":
     209    import argparse
     210    parser = argparse.ArgumentParser(
     211        description='Run a mod_gnutls server test')
     212    parser.add_argument('--test-number', type=int,
     213                        required=True, help='load YAML test configuration')
     214    parser.add_argument('--log-connection', type=str, default=None,
     215                        help='write connection log to this file')
     216    parser.add_argument('--log-responses', type=str, default=None,
     217                        help='write HTTP responses to this file')
     218
     219    # enable bash completion if argcomplete is available
     220    try:
     221        import argcomplete
     222        argcomplete.autocomplete(parser)
     223    except ImportError:
     224        pass
     225
     226    args = parser.parse_args()
     227
     228    main(args)
Note: See TracChangeset for help on using the changeset viewer.