Skip to content

Commit f7dd8a9

Browse files
author
Andrei Neagu
committed
fix tests and pylint
1 parent a0345f7 commit f7dd8a9

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

packages/simcore-sdk/src/simcore_sdk/node_ports_common/dbmanager.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ async def _create_db_engine() -> aiopg.sa.Engine:
7373
settings = NodePortsSettings.create_from_envs()
7474
dsn = DataSourceName(
7575
application_name=f"{__name__}_{socket.gethostname()}_{os.getpid()}",
76+
# pylint:disable=no-member
7677
database=settings.POSTGRES_SETTINGS.POSTGRES_DB,
7778
user=settings.POSTGRES_SETTINGS.POSTGRES_USER,
7879
password=settings.POSTGRES_SETTINGS.POSTGRES_PASSWORD.get_secret_value(),

packages/simcore-sdk/src/simcore_sdk/node_ports_common/storage_endpoint.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
def is_storage_secure() -> bool:
99
settings = NodePortsSettings.create_from_envs()
1010
node_ports_storage_auth = settings.NODE_PORTS_STORAGE_AUTH
11+
# pylint:disable=no-member
1112
is_secure: bool = node_ports_storage_auth.STORAGE_SECURE
1213
return is_secure
1314

1415

1516
@lru_cache
1617
def get_base_url() -> str:
1718
settings = NodePortsSettings.create_from_envs()
19+
# pylint:disable=no-member
1820
base_url: str = settings.NODE_PORTS_STORAGE_AUTH.api_base_url
1921
return base_url
2022

@@ -24,6 +26,7 @@ def get_basic_auth() -> BasicAuth | None:
2426
settings = NodePortsSettings.create_from_envs()
2527
node_ports_storage_auth = settings.NODE_PORTS_STORAGE_AUTH
2628

29+
# pylint:disable=no-member
2730
if node_ports_storage_auth.auth_required:
2831
assert node_ports_storage_auth.STORAGE_USERNAME is not None # nosec
2932
assert node_ports_storage_auth.STORAGE_PASSWORD is not None # nosec

packages/simcore-sdk/tests/unit/test_node_ports_v2_links.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
from typing import Dict
21
from uuid import uuid4
32

43
import pytest
5-
from pydantic import TypeAdapter, ValidationError
4+
from pydantic import ValidationError
65
from simcore_sdk.node_ports_v2.links import DownloadLink, FileLink, PortLink
76

87

@@ -23,7 +22,7 @@ def test_valid_port_link():
2322
{"nodeUuid": f"{uuid4()}", "output": "some:key"},
2423
],
2524
)
26-
def test_invalid_port_link(port_link: Dict[str, str]):
25+
def test_invalid_port_link(port_link: dict[str, str]):
2726
with pytest.raises(ValidationError):
2827
PortLink(**port_link)
2928

@@ -36,7 +35,7 @@ def test_invalid_port_link(port_link: Dict[str, str]):
3635
{"label": "some stuff"},
3736
],
3837
)
39-
def test_invalid_download_link(download_link: Dict[str, str]):
38+
def test_invalid_download_link(download_link: dict[str, str]):
4039
with pytest.raises(ValidationError):
4140
DownloadLink(**download_link)
4241

@@ -49,6 +48,6 @@ def test_invalid_download_link(download_link: Dict[str, str]):
4948
{"path": "/somefile/blahblah:"},
5049
],
5150
)
52-
def test_invalid_file_link(file_link: Dict[str, str]):
51+
def test_invalid_file_link(file_link: dict[str, str]):
5352
with pytest.raises(ValidationError):
5453
FileLink(**file_link)

packages/simcore-sdk/tests/unit/test_node_ports_v2_nodeports_v2.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# pylint:disable=redefined-outer-name
44
# pylint:disable=protected-access
55

6-
import asyncio
76
from pathlib import Path
87
from typing import Any, Callable
98
from unittest.mock import AsyncMock
@@ -230,10 +229,7 @@ async def test_node_ports_v2_packages(
230229
@pytest.fixture
231230
def mock_port_set(mocker: MockFixture) -> None:
232231
async def _always_raise_error(*args, **kwargs):
233-
async def _i_raise_errors():
234-
raise ValidationError("invalid")
235-
236-
return asyncio.create_task(_i_raise_errors())
232+
raise ValidationError.from_exception_data(title="Just a test", line_errors=[])
237233

238234
mocker.patch(
239235
"simcore_sdk.node_ports_v2.port.Port._set", side_effect=_always_raise_error
@@ -278,4 +274,5 @@ async def _mock_callback(*args, **kwargs):
278274
+ list(original_outputs.values())
279275
},
280276
progress_bar=progress_bar,
277+
outputs_callbacks=None,
281278
)

0 commit comments

Comments
 (0)