1#*************************************************************************** 2# _ _ ____ _ 3# Project ___| | | | _ \| | 4# / __| | | | |_) | | 5# | (__| |_| | _ <| |___ 6# \___|\___/|_| \_\_____| 7# 8# Copyright (C) 2008 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al. 9# 10# This software is licensed as described in the file COPYING, which 11# you should have received as part of this distribution. The terms 12# are also available at https://curl.se/docs/copyright.html. 13# 14# You may opt to use, copy, modify, merge, publish, distribute and/or sell 15# copies of the Software, and permit persons to whom the Software is 16# furnished to do so, under the terms of the COPYING file. 17# 18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 19# KIND, either express or implied. 20# 21# SPDX-License-Identifier: curl 22# 23########################################################################### 24# 25import sys, os 26 27sys.path.append(os.path.join(os.path.dirname(__file__), 'http')) 28 29from testenv import Env 30 31 32def pytest_report_header(config): 33 # Env inits its base properties only once, we can report them here 34 env = Env() 35 report = [ 36 f'Testing curl {env.curl_version()}', 37 f' httpd: {env.httpd_version()}, http:{env.http_port} https:{env.https_port}', 38 f' httpd-proxy: {env.httpd_version()}, http:{env.proxy_port} https:{env.proxys_port}' 39 ] 40 if env.have_h3(): 41 report.extend([ 42 f' nghttpx: {env.nghttpx_version()}, h3:{env.https_port}' 43 ]) 44 if env.has_caddy(): 45 report.extend([ 46 f' Caddy: {env.caddy_version()}, http:{env.caddy_http_port} https:{env.caddy_https_port}' 47 ]) 48 return '\n'.join(report) 49 50 51def pytest_addoption(parser): 52 parser.addoption("--repeat", action="store", type=int, default=1, 53 help='Number of times to repeat each test') 54 55 56def pytest_generate_tests(metafunc): 57 if "repeat" in metafunc.fixturenames: 58 count = int(metafunc.config.getoption("repeat")) 59 metafunc.fixturenames.append('tmp_ct') 60 metafunc.parametrize('repeat', range(count)) 61