conftest.py 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. #
  25. import sys, os
  26. sys.path.append(os.path.join(os.path.dirname(__file__), 'http'))
  27. from testenv import Env
  28. def pytest_report_header(config):
  29. # Env inits its base properties only once, we can report them here
  30. env = Env()
  31. report = [
  32. f'Testing curl {env.curl_version()}',
  33. f' httpd: {env.httpd_version()}, http:{env.http_port} https:{env.https_port}',
  34. f' httpd-proxy: {env.httpd_version()}, http:{env.proxy_port} https:{env.proxys_port}'
  35. ]
  36. if env.have_h3():
  37. report.extend([
  38. f' nghttpx: {env.nghttpx_version()}, h3:{env.https_port}'
  39. ])
  40. if env.has_caddy():
  41. report.extend([
  42. f' Caddy: {env.caddy_version()}, http:{env.caddy_http_port} https:{env.caddy_https_port}'
  43. ])
  44. return '\n'.join(report)
  45. def pytest_addoption(parser):
  46. parser.addoption("--repeat", action="store", type=int, default=1,
  47. help='Number of times to repeat each test')
  48. def pytest_generate_tests(metafunc):
  49. if "repeat" in metafunc.fixturenames:
  50. count = int(metafunc.config.getoption("repeat"))
  51. metafunc.fixturenames.append('tmp_ct')
  52. metafunc.parametrize('repeat', range(count))