Skip to content

Commit 7afde22

Browse files
committed
fix pylint
1 parent 85fdb00 commit 7afde22

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

services/api-server/src/simcore_service_api_server/exceptions/service_errors_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# pylint: disable=dangerous-default-value
12
import asyncio
23
import logging
34
from collections.abc import Callable, Coroutine, Mapping
@@ -164,6 +165,8 @@ def service_exception_mapper(
164165
[Callable[Concatenate[Self, P], Coroutine[Any, Any, R]]],
165166
Callable[Concatenate[Self, P], Coroutine[Any, Any, R]],
166167
]:
168+
assert len(http_status_map.keys()) > 0 or len(rpc_exception_map.keys()) > 0
169+
167170
def _decorator(member_func: Callable[Concatenate[Self, P], Coroutine[Any, Any, R]]):
168171
_assert_correct_kwargs(
169172
func=member_func,

services/api-server/tests/unit/test_exceptions.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# pylint: disable=unused-variable
22
# pylint: disable=unused-argument
33
# pylint: disable=redefined-outer-name
4-
4+
# pylint: disable=too-many-arguments
55

66
from http import HTTPStatus
77
from uuid import UUID
@@ -25,8 +25,8 @@
2525

2626
async def test_backend_service_exception_mapper():
2727
@service_exception_mapper(
28-
"DummyService",
29-
{status.HTTP_400_BAD_REQUEST: ProfileNotFoundError},
28+
service_name="DummyService",
29+
http_status_map={status.HTTP_400_BAD_REQUEST: ProfileNotFoundError},
3030
)
3131
async def my_endpoint(status_code: int):
3232
raise HTTPStatusError(
@@ -103,26 +103,26 @@ async def coro1(project_id):
103103
pass
104104

105105
with pytest.raises(AssertionError):
106-
_assert_correct_kwargs(func=coro1, status_map=status_map)
106+
_assert_correct_kwargs(func=coro1, exception_types=set(status_map.values()))
107107

108108
async def coro2(project_id=UUID("9c201eb7-ba04-4d9b-abe6-f16b406ca86d")):
109109
pass
110110

111111
with pytest.raises(AssertionError) as exc:
112-
_assert_correct_kwargs(func=coro2, status_map=status_map)
112+
_assert_correct_kwargs(func=coro2, exception_types=set(status_map.values()))
113113

114114
async def coro3(*, project_id):
115115
pass
116116

117-
_assert_correct_kwargs(func=coro3, status_map=status_map)
117+
_assert_correct_kwargs(func=coro3, exception_types=set(status_map.values()))
118118

119119
async def coro4(*, project_id=UUID("ce56af2e-e9e5-46a4-8067-662077de5528")):
120120
pass
121121

122-
_assert_correct_kwargs(func=coro4, status_map=status_map)
122+
_assert_correct_kwargs(func=coro4, exception_types=set(status_map.values()))
123123

124124
async def coro5(*, project_uuid):
125125
pass
126126

127127
with pytest.raises(AssertionError):
128-
_assert_correct_kwargs(func=coro5, status_map=status_map)
128+
_assert_correct_kwargs(func=coro5, exception_types=set(status_map.values()))

services/api-server/tests/unit/test_licensed_items.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# pylint: disable=redefined-outer-name
2+
# pylint: disable=unused-argument
3+
# pylint: disable=unused-variable
4+
# pylint: disable=too-many-arguments
15
import asyncio
26

37
import pytest

0 commit comments

Comments
 (0)