mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 01:26:51 +03:00
Merge branch 'release/4.35.2' into master
This commit is contained in:
commit
cde7dee4b3
|
@ -7,6 +7,12 @@ that were made in every particular version.
|
|||
From version 0.7.6 *Dependency Injector* framework strictly
|
||||
follows `Semantic versioning`_
|
||||
|
||||
4.35.2
|
||||
------
|
||||
- Update wiring to support modules provided as packages.
|
||||
See issue `#481 <https://github.com/ets-labs/python-dependency-injector/issues/481>`_.
|
||||
Thanks to `@Sadbot <https://github.com/Sadbot>`_ for demonstrating the issue.
|
||||
|
||||
4.35.1
|
||||
------
|
||||
- Fix a container issue with supporting custom string types.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""Top-level package."""
|
||||
|
||||
__version__ = '4.35.1'
|
||||
__version__ = '4.35.2'
|
||||
"""Version number.
|
||||
|
||||
:type: str
|
||||
|
|
|
@ -552,6 +552,8 @@ def _unbind_injections(fn: Callable[..., Any]) -> None:
|
|||
|
||||
def _fetch_modules(package):
|
||||
modules = [package]
|
||||
if not hasattr(package, '__path__') or not hasattr(package, '__name__'):
|
||||
return modules
|
||||
for module_info in pkgutil.walk_packages(
|
||||
path=package.__path__,
|
||||
prefix=package.__name__ + '.',
|
||||
|
|
|
@ -310,6 +310,18 @@ class WiringTest(unittest.TestCase):
|
|||
self.assertIsInstance(service, Service)
|
||||
|
||||
|
||||
class ModuleAsPackagingTest(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.container = Container(config={'a': {'b': {'c': 10}}})
|
||||
self.addCleanup(self.container.unwire)
|
||||
|
||||
def test_module_as_package_wiring(self):
|
||||
# See: https://github.com/ets-labs/python-dependency-injector/issues/481
|
||||
self.container.wire(packages=[module])
|
||||
self.assertIsInstance(module.service, Service)
|
||||
|
||||
|
||||
class WiringAndQueue(unittest.TestCase):
|
||||
|
||||
def test_wire_queue(self) -> None:
|
||||
|
|
Loading…
Reference in New Issue
Block a user