Fixing static port for test. Use unused port

This commit is contained in:
2024-01-08 19:50:38 +01:00
parent 5f4eb1f521
commit 2aa7dbcf09
2 changed files with 3 additions and 8 deletions

View File

@@ -12,6 +12,7 @@ from openapi_client import ApiClient, Configuration
from clan_cli.webui.app import app
from ports import PortFunction
@pytest.fixture(scope="session")
def test_client() -> TestClient:
@@ -31,8 +32,8 @@ def get_health(*, url: str, max_retries: int = 20, delay: float = 0.2) -> str |
# Pytest fixture to run the server in a separate process
@pytest.fixture(scope="session")
def server_url() -> Generator[str, None, None]:
port = 8000
def server_url(unused_tcp_port: PortFunction) -> Generator[str, None, None]:
port = unused_tcp_port()
host = "127.0.0.1"
proc = Process(
target=uvicorn.run,