Changeset b457e67 in mod_gnutls
- Timestamp:
- Dec 31, 2019, 11:26:25 AM (3 years ago)
- Branches:
- asyncio, main, master, proxy-ticket
- Children:
- 92cf138
- Parents:
- ac516aa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/runtest.py
rac516aa rb457e67 173 173 # Run the test connections 174 174 with contextlib.ExitStack() as stack: 175 log_file = None176 output_file = None177 if args.log_connection:178 log_file = stack.enter_context(open(args.log_connection, 'w'))179 if args.log_responses:180 output_file = stack.enter_context(open(args.log_responses, 'w'))181 182 175 if plugin.run_connection: 183 176 plugin.run_connection(testname, 184 conn_log= log_file,185 response_log= output_file)177 conn_log=args.log_connection, 178 response_log=args.log_responses) 186 179 else: 187 180 test_conf = stack.enter_context( … … 189 182 run_test_conf(test_conf, 190 183 float(os.environ.get('TEST_QUERY_TIMEOUT', 5.0)), 191 conn_log=log_file, response_log=output_file) 184 conn_log=args.log_connection, 185 response_log=args.log_responses) 192 186 193 187 # run extra checks the test's hooks.py might define 194 188 if plugin.post_check: 195 log_file = None 196 output_file = None 197 with contextlib.ExitStack() as stack: 198 # TODO: The log files should be created as temporary 199 # files if needed by the plugin but not configured. 200 if args.log_connection: 201 log_file = stack.enter_context(open(args.log_connection, 'r')) 202 if args.log_responses: 203 output_file = stack.enter_context(open(args.log_responses, 'r')) 204 plugin.post_check(conn_log=log_file, response_log=output_file) 189 if args.log_connection: 190 args.log_connection.seek(0) 191 if args.log_responses: 192 args.log_responses.seek(0) 193 plugin.post_check(conn_log=args.log_connection, 194 response_log=args.log_responses) 205 195 206 196 … … 212 202 parser.add_argument('--test-number', type=int, 213 203 required=True, help='load YAML test configuration') 214 parser.add_argument('--log-connection', type=str, default=None, 204 # TODO: The log files should be created as temporary 205 # files if needed by the plugin but not configured. 206 parser.add_argument('--log-connection', type=argparse.FileType('w+'), 207 default=None, 215 208 help='write connection log to this file') 216 parser.add_argument('--log-responses', type=str, default=None, 209 parser.add_argument('--log-responses', type=argparse.FileType('w+'), 210 default=None, 217 211 help='write HTTP responses to this file') 218 212 … … 226 220 args = parser.parse_args() 227 221 228 main(args) 222 with contextlib.ExitStack() as stack: 223 if args.log_connection: 224 stack.enter_context(contextlib.closing(args.log_connection)) 225 if args.log_responses: 226 stack.enter_context(contextlib.closing(args.log_responses)) 227 main(args)
Note: See TracChangeset
for help on using the changeset viewer.