Skip to content

Commit 688deb1

Browse files
authored
Fix/python client e2e (#166)
* updates pre-commit config * fix model dump with a tmp fix
1 parent 2c8d0a6 commit 688deb1

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# See https://pre-commit.com/hooks.html for more hooks
22
exclude: "^.venv$|^.cache$|^.pytest_cache$"
33
default_language_version:
4-
python: python3.9
4+
python: python3.10
55
repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
77
rev: v4.3.0

clients/python/test/e2e/ci/e2e/e2e/_models.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import osparc
66
from packaging.version import InvalidVersion, Version
7-
from pydantic import BaseModel, field_validator, SecretStr
7+
from pydantic import BaseModel, SecretStr, field_validator
88
from pydantic_settings import BaseSettings, SettingsConfigDict
99

1010
# Holds classes for passing data around between scripts.
@@ -20,7 +20,9 @@ class ServerSettings(BaseSettings):
2020
model_config = SettingsConfigDict(env_prefix="osparc_api_")
2121

2222
def __hash__(self):
23-
return hash(self.host + self.key.get_secret_value() + self.secret.get_secret_value())
23+
return hash(
24+
self.host + self.key.get_secret_value() + self.secret.get_secret_value()
25+
)
2426

2527
def __eq__(self, other):
2628
return (
@@ -114,9 +116,19 @@ def write_to_file(self, pth: Path = Path() / "pytest.ini") -> None:
114116
"""Generate the pytest.ini file"""
115117
pth.unlink(missing_ok=True)
116118
pth.parent.mkdir(exist_ok=True)
119+
117120
config: configparser.ConfigParser = configparser.ConfigParser()
121+
118122
for field_name in self.model_fields:
119123
model: BaseModel = getattr(self, field_name)
120-
config[field_name] = model.model_dump(exclude_none=True)
124+
# WARNING: this is a temporary solution until we learn how to customize
125+
# the serialization used in model_dump
126+
config[field_name] = {
127+
name: value.get_secret_value()
128+
if isinstance(value, SecretStr)
129+
else value
130+
for name, value in model.model_dump(exclude_none=True).items()
131+
}
132+
121133
with open(pth, "w") as f:
122134
config.write(f)

0 commit comments

Comments
 (0)