Skip to content

Commit 0aca88f

Browse files
author
Sergio García Prado
committed
ISSUE #346
* Minor improvements.
1 parent 3656a66 commit 0aca88f

File tree

2 files changed

+9
-12
lines changed
  • packages/core/minos-microservice-common

2 files changed

+9
-12
lines changed

packages/core/minos-microservice-common/minos/common/config/v2.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,21 +148,19 @@ def _parse_periodic_interface(data: dict[str, Any]) -> dict[str, Any]:
148148
return data
149149

150150
def _get_pools(self) -> dict[str, type]:
151-
from ..pools import (
152-
PoolFactory,
153-
)
154-
155-
factory = PoolFactory
156-
157151
try:
158152
types = self.get_by_key("pools")
159153
except MinosConfigException:
160-
types = dict()
154+
return dict()
161155

162156
types = {name: import_module(classname) for name, classname in types.items()}
163157

158+
from ..pools import (
159+
PoolFactory,
160+
)
161+
164162
return {
165-
"factory": factory,
163+
"factory": PoolFactory,
166164
"types": types,
167165
}
168166

packages/core/minos-microservice-common/tests/test_common/test_config/test_v2/test_base.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ def test_injections(self):
7070
]
7171
self.assertEqual(expected, self.config.get_injections())
7272

73-
def test_injections_not_defined(self): # FIXME
73+
def test_injections_not_defined(self):
7474
with patch.object(ConfigV2, "get_by_key", side_effect=MinosConfigException("")):
75-
self.assertEqual([PoolFactory], self.config.get_injections())
75+
self.assertEqual(list(), self.config.get_injections())
7676

7777
def test_injections_not_injectable(self):
7878
with patch.object(ConfigV2, "_get_pools", return_value={"factory": int}):
@@ -149,9 +149,8 @@ def test_pools(self):
149149
self.assertEqual(expected, self.config.get_pools())
150150

151151
def test_pools_not_defined(self):
152-
expected = {"factory": PoolFactory, "types": {}}
153152
with patch.object(ConfigV2, "get_by_key", side_effect=MinosConfigException("")):
154-
self.assertEqual(expected, self.config.get_pools())
153+
self.assertEqual(dict(), self.config.get_pools())
155154

156155
def test_services(self):
157156
self.assertEqual([float, int], self.config.get_services())

0 commit comments

Comments
 (0)