Bump version to 4.32.1

This commit is contained in:
Roman Mogylatov 2021-04-25 13:45:34 -04:00
parent fab4e3e5be
commit 0f3e170711
5 changed files with 55 additions and 10 deletions

View File

@ -7,6 +7,13 @@ that were made in every particular version.
From version 0.7.6 *Dependency Injector* framework strictly
follows `Semantic versioning`_
4.32.1
------
- Fix a bug with ``List`` provider not working in async mode.
See issue: `#450 <https://github.com/ets-labs/python-dependency-injector/issues/450>`_.
Thanks to `@mxab <https://github.com/mxab>`_ for reporting the issue.
- Add async mode tests for ``List`` and ``Dict`` provider.
4.32.0
------
- Add ``ContextLocalSingleton`` provider.

View File

@ -1,6 +1,6 @@
"""Top-level package."""
__version__ = '4.32.0'
__version__ = '4.32.1'
"""Version number.
:type: str

View File

@ -62896,7 +62896,7 @@ static PyObject *__pyx_gb_19dependency_injector_9providers_4List_7related_2gener
*
* cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
* """Return result of provided callable's call."""
* return list(__provide_positional_args(args, self.__args, self.__args_len))
* return __provide_positional_args(args, self.__args, self.__args_len)
*/
static PyObject *__pyx_pw_19dependency_injector_9providers_4List_13_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
@ -62993,7 +62993,7 @@ static PyObject *__pyx_f_19dependency_injector_9providers_4List__provide(struct
/* "dependency_injector/providers.pyx":3214
* cpdef object _provide(self, tuple args, dict kwargs):
* """Return result of provided callable's call."""
* return list(__provide_positional_args(args, self.__args, self.__args_len)) # <<<<<<<<<<<<<<
* return __provide_positional_args(args, self.__args, self.__args_len) # <<<<<<<<<<<<<<
*
*
*/
@ -63003,11 +63003,8 @@ static PyObject *__pyx_f_19dependency_injector_9providers_4List__provide(struct
__pyx_t_2 = __pyx_f_19dependency_injector_9providers___provide_positional_args(__pyx_v_args, ((PyObject*)__pyx_t_1), __pyx_v_self->__pyx___args_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3214, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PySequence_List(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3214, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* "dependency_injector/providers.pyx":3212
@ -63015,7 +63012,7 @@ static PyObject *__pyx_f_19dependency_injector_9providers_4List__provide(struct
*
* cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<<
* """Return result of provided callable's call."""
* return list(__provide_positional_args(args, self.__args, self.__args_len))
* return __provide_positional_args(args, self.__args, self.__args_len)
*/
/* function exit code */

View File

@ -3211,7 +3211,7 @@ cdef class List(Provider):
cpdef object _provide(self, tuple args, dict kwargs):
"""Return result of provided callable's call."""
return list(__provide_positional_args(args, self.__args, self.__args_len))
return __provide_positional_args(args, self.__args, self.__args_len)
cdef class Dict(Provider):

View File

@ -868,6 +868,47 @@ class DependencyTests(AsyncTestCase):
self.assertEqual(dependency4, dependency)
class ListTests(AsyncTestCase):
def test_provide(self):
# See issue: https://github.com/ets-labs/python-dependency-injector/issues/450
async def create_resource(param: str):
return param
class Container(containers.DeclarativeContainer):
resources = providers.List(
providers.Resource(create_resource, 'foo'),
providers.Resource(create_resource, 'bar')
)
container = Container()
resources = self._run(container.resources())
self.assertEqual(resources[0], 'foo')
self.assertEqual(resources[1], 'bar')
class DictTests(AsyncTestCase):
def test_provide(self):
async def create_resource(param: str):
return param
class Container(containers.DeclarativeContainer):
resources = providers.Dict(
foo=providers.Resource(create_resource, 'foo'),
bar=providers.Resource(create_resource, 'bar')
)
container = Container()
resources = self._run(container.resources())
self.assertEqual(resources['foo'], 'foo')
self.assertEqual(resources['bar'], 'bar')
class OverrideTests(AsyncTestCase):
def test_provider(self):