tests: use dynamic ports numbers in pytest suite

- necessary ports are bound at start of test suite and then
  given to server fixtures for use.
- this make parallel use of pytest (in separate directories),
  practically safe for use as OS tend to not reuse such port numbers
  for a while

Closes #10692
This commit is contained in:
Stefan Eissing 2023-03-06 16:11:11 +01:00 committed by Daniel Stenberg
parent 257416023d
commit b0564c1d54
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
6 changed files with 118 additions and 39 deletions

View file

@ -34,10 +34,6 @@ sys.path.append(os.path.join(os.path.dirname(__file__), '.'))
from testenv import Env, Nghttpx, Httpd
def pytest_report_header(config, startdir):
return f"curl http tests"
@pytest.fixture(scope="package")
def env(pytestconfig) -> Env:
env = Env(pytestconfig=pytestconfig)
@ -46,6 +42,10 @@ def env(pytestconfig) -> Env:
env.setup()
return env
@pytest.fixture(scope="package", autouse=True)
def log_global_env_facts(record_testsuite_property, env):
record_testsuite_property("http-port", env.http_port)
@pytest.fixture(scope='package')
def httpd(env) -> Httpd: