mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 09:36:48 +03:00
Merge branch 'release/4.10.1' into master
This commit is contained in:
commit
2cfc61aa37
|
@ -3,7 +3,7 @@ dist: xenial
|
|||
language: python
|
||||
jobs:
|
||||
include:
|
||||
- python: 3.8
|
||||
- python: 3.9
|
||||
env: TOXENV=coveralls DEPENDENCY_INJECTOR_DEBUG_MODE=1
|
||||
install:
|
||||
- pip install tox
|
||||
|
|
|
@ -7,6 +7,15 @@ that were made in every particular version.
|
|||
From version 0.7.6 *Dependency Injector* framework strictly
|
||||
follows `Semantic versioning`_
|
||||
|
||||
4.10.1
|
||||
------
|
||||
- Fix a Python 3.9 specific bug in ``wiring`` module: introspection doesn't work for
|
||||
builtin ``types.GenericAlias``. This resulted in wiring failure for modules
|
||||
importing ``queue.Queue``.
|
||||
See issue `#362 <https://github.com/ets-labs/python-dependency-injector/issues/362>`_.
|
||||
Thanks `@ventaquil <https://github.com/ventaquil>`_ for the bug report.
|
||||
- Switch Coveralls reporting Travis Job to run on Python 3.9.
|
||||
|
||||
4.10.0
|
||||
------
|
||||
- Add ``strict`` mode and ``required`` modifier for ``Configuration`` provider.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""Top-level package."""
|
||||
|
||||
__version__ = '4.10.0'
|
||||
__version__ = '4.10.1'
|
||||
"""Version number.
|
||||
|
||||
:type: str
|
||||
|
|
|
@ -28,6 +28,12 @@ else:
|
|||
class GenericMeta(type):
|
||||
...
|
||||
|
||||
# Hotfix, see: https://github.com/ets-labs/python-dependency-injector/issues/362
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
else:
|
||||
GenericAlias = None
|
||||
|
||||
|
||||
try:
|
||||
from fastapi.params import Depends as FastAPIDepends
|
||||
|
@ -333,6 +339,10 @@ def _unpatch(
|
|||
def _fetch_reference_injections(
|
||||
fn: Callable[..., Any],
|
||||
) -> Tuple[Dict[str, Any], Dict[str, Any]]:
|
||||
# # Hotfix, see: https://github.com/ets-labs/python-dependency-injector/issues/362
|
||||
if GenericAlias and fn is GenericAlias:
|
||||
fn = fn.__init__
|
||||
|
||||
signature = inspect.signature(fn)
|
||||
|
||||
injections = {}
|
||||
|
|
5
tests/unit/samples/wiringsamples/queuemodule.py
Normal file
5
tests/unit/samples/wiringsamples/queuemodule.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Hotfix, see: https://github.com/ets-labs/python-dependency-injector/issues/362
|
||||
from queue import Queue
|
||||
|
||||
|
||||
__all__ = ('Queue',)
|
|
@ -263,6 +263,21 @@ class WiringTest(unittest.TestCase):
|
|||
self.assertIsInstance(service, Service)
|
||||
|
||||
|
||||
class WiringAndQueue(unittest.TestCase):
|
||||
|
||||
def test_wire_queue(self) -> None:
|
||||
from wiringsamples import queuemodule
|
||||
container = Container()
|
||||
self.addCleanup(container.unwire)
|
||||
|
||||
# Should not raise exception
|
||||
# See: https://github.com/ets-labs/python-dependency-injector/issues/362
|
||||
try:
|
||||
container.wire(modules=[queuemodule])
|
||||
except:
|
||||
raise
|
||||
|
||||
|
||||
class WiringAndFastAPITest(unittest.TestCase):
|
||||
|
||||
container: Container
|
||||
|
|
Loading…
Reference in New Issue
Block a user