conftest.py 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. if env.has_vsftpd():
  45. report.extend([
  46. f' VsFTPD: {env.vsftpd_version()}, ftp:{env.ftp_port}, ftps:{env.ftps_port}'
  47. ])
  48. return '\n'.join(report)
  49. def pytest_addoption(parser):
  50. parser.addoption("--repeat", action="store", type=int, default=1,
  51. help='Number of times to repeat each test')
  52. def pytest_generate_tests(metafunc):
  53. if "repeat" in metafunc.fixturenames:
  54. count = int(metafunc.config.getoption("repeat"))
  55. metafunc.fixturenames.append('tmp_ct')
  56. metafunc.parametrize('repeat', range(count))