Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion sdk/python/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,11 @@ def pytest_generate_tests(metafunc: pytest.Metafunc):

@pytest.fixture(scope="session")
def python_server(environment):
assert not _check_port_open("localhost", environment.get_local_server_port())

proc = Process(
target=start_test_local_server,
args=(environment.feature_store.repo_path, environment.get_local_server_port()),
daemon=True,
)
if (
environment.python_feature_server
Expand All @@ -298,6 +299,15 @@ def python_server(environment):
if proc.is_alive():
proc.kill()

# wait server to free the port
wait_retry_backoff(
lambda: (
None,
not _check_port_open("localhost", environment.get_local_server_port()),
),
timeout_secs=30,
)


def _check_port_open(host, port) -> bool:
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
Expand Down