Skip to content

Commit f69dc05

Browse files
committed
merge itis/master into master
2 parents ea7239e + 51af1dd commit f69dc05

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

clients/python/test/e2e/conftest.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,15 @@
1515
import pytest
1616
from httpx import AsyncClient, BasicAuth
1717
from numpy import random
18-
from osparc._models import ConfigurationModel
18+
from packaging.version import Version
1919
from pydantic import ByteSize
2020

21+
try:
22+
from osparc._models import ConfigurationModel
23+
except ImportError:
24+
pass
25+
26+
2127
_KB: ByteSize = ByteSize(1024) # in bytes
2228
_MB: ByteSize = ByteSize(_KB * 1024) # in bytes
2329
_GB: ByteSize = ByteSize(_MB * 1024) # in bytes
@@ -96,12 +102,21 @@ def api_client() -> Iterable[osparc.ApiClient]:
96102

97103
@pytest.fixture
98104
def async_client() -> Iterable[AsyncClient]:
99-
configuration = ConfigurationModel()
105+
if Version(osparc.__version__) >= Version("8.0.0"):
106+
configuration = ConfigurationModel()
107+
host = configuration.OSPARC_API_HOST.rstrip("/")
108+
username = configuration.OSPARC_API_KEY
109+
password = configuration.OSPARC_API_SECRET
110+
else:
111+
host = os.environ.get("OSPARC_API_HOST")
112+
username = os.environ.get("OSPARC_API_KEY")
113+
password = os.environ.get("OSPARC_API_SECRET")
114+
assert host and username and password
100115
yield AsyncClient(
101-
base_url=f"{configuration.OSPARC_API_HOST}".rstrip("/"),
116+
base_url=host,
102117
auth=BasicAuth(
103-
username=configuration.OSPARC_API_KEY,
104-
password=configuration.OSPARC_API_SECRET,
118+
username=username,
119+
password=password,
105120
),
106121
) # type: ignore
107122

0 commit comments

Comments
 (0)