Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<a align="center" href="https://docs.geti.intel.com/">
<img
width="120%"
src="docs/geti-logo.png?raw=true"
src="https://github.com/user-attachments/assets/9faee9f9-8c04-4287-8302-6b9d8c8675fe"
alt="Geti™ enables anyone from domain experts to data scientists to rapidly develop production-ready AI models."
>
</a>
Expand All @@ -13,7 +13,7 @@
<br>

[![python](https://img.shields.io/badge/python-3.10%2B-green)]()
![Geti](https://img.shields.io/badge/Intel%C2%AE%20Geti%E2%84%A2-2.12-blue?link=https%3A%2F%2Fgeti.intel.com%2F)
![Geti](https://img.shields.io/badge/Intel%C2%AE%20Geti%E2%84%A2-2.13-blue?link=https%3A%2F%2Fgeti.intel.com%2F)
[![openvino](https://img.shields.io/badge/openvino-2025.2-purple)](https://github.com/openvinotoolkit/openvino)

![Pre-merge Tests Status](https://img.shields.io/github/actions/workflow/status/open-edge-platform/geti-sdk/pre-merge-tests.yml?label=pre-merge%20tests&link=https%3A%2F%2Fgithub.com%2Fopen-edge-platform%2Fgeti-sdk%2Factions%2Fworkflows%2Fpre-merge-tests.yml)
Expand Down
Binary file removed docs/geti-logo.png
Binary file not shown.
1 change: 1 addition & 0 deletions geti_sdk/utils/workspace_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class MultipleWorkspacesException(Exception):
"""Exception raised when multiple workspaces are available thus it is not possible to automatically select one."""

def __init__(self, workspaces_list: list) -> None:
self.available_workspaces = workspaces_list
ws_ids_and_names = [(ws["id"], ws["name"]) for ws in workspaces_list]
error_message = (
f"Multiple workspaces are available; please select one and provide its id through the 'workspace_id' "
Expand Down
10 changes: 9 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

from geti_sdk import Geti
from geti_sdk.http_session import ServerCredentialConfig, ServerTokenConfig
from geti_sdk.utils.workspace_helpers import MultipleWorkspacesException
from tests.helpers.project_helpers import remove_all_test_projects

from .helpers import SdkTestMode, get_sdk_fixtures, replace_unique_entries_in_cassettes
Expand Down Expand Up @@ -174,7 +175,14 @@ def _get_geti_instance() -> Geti:
proxies = {"http": GETI_HTTP_PROXY, "https": GETI_HTTPS_PROXY}
else:
proxies = None
return Geti(host=HOST, **auth_params, proxies=proxies, verify_certificate=False)

# handle multiple workspaces
try:
return Geti(host=HOST, **auth_params, proxies=proxies, verify_certificate=False)
except MultipleWorkspacesException as exe:
workspaces_list = exe.available_workspaces
workspace_id = workspaces_list[0]["id"]
return Geti(host=HOST, **auth_params, proxies=proxies, verify_certificate=False, workspace_id=workspace_id)


def pytest_sessionstart(session: Session) -> None:
Expand Down
47 changes: 35 additions & 12 deletions tests/fixtures/geti.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from geti_sdk import Geti
from geti_sdk.http_session import GetiSession, ServerCredentialConfig, ServerTokenConfig
from geti_sdk.utils.workspace_helpers import MultipleWorkspacesException
from tests.helpers.constants import CASSETTE_EXTENSION, DUMMY_PASSWORD, DUMMY_USER


Expand Down Expand Up @@ -56,12 +57,23 @@ def fxt_geti(fxt_vcr, fxt_server_config: ServerTokenConfig | ServerCredentialCon
}
else:
auth_params = {"token": fxt_server_config.token}
yield Geti(
host=fxt_server_config.host,
verify_certificate=fxt_server_config.has_valid_certificate,
proxies=fxt_server_config.proxies,
**auth_params,
)
try:
yield Geti(
host=fxt_server_config.host,
verify_certificate=fxt_server_config.has_valid_certificate,
proxies=fxt_server_config.proxies,
**auth_params,
)
except MultipleWorkspacesException as exe:
workspaces_list = exe.available_workspaces
workspace_id = workspaces_list[0]["id"]
yield Geti(
host=fxt_server_config.host,
verify_certificate=fxt_server_config.has_valid_certificate,
proxies=fxt_server_config.proxies,
**auth_params,
workspace_id=workspace_id,
)


@pytest.fixture(scope="module")
Expand All @@ -75,9 +87,20 @@ def fxt_geti_no_vcr(
}
else:
auth_params = {"token": fxt_server_config.token}
yield Geti(
host=fxt_server_config.host,
proxies=fxt_server_config.proxies,
**auth_params,
verify_certificate=fxt_server_config.has_valid_certificate,
)
try:
yield Geti(
host=fxt_server_config.host,
proxies=fxt_server_config.proxies,
**auth_params,
verify_certificate=fxt_server_config.has_valid_certificate,
)
except MultipleWorkspacesException as exe:
workspaces_list = exe.available_workspaces
workspace_id = workspaces_list[0]["id"]
yield Geti(
host=fxt_server_config.host,
proxies=fxt_server_config.proxies,
**auth_params,
verify_certificate=fxt_server_config.has_valid_certificate,
workspace_id=workspace_id,
)
Loading