mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-07-07 22:03:13 +03:00
Fix wiring module loader uninstallation issue
This commit is contained in:
parent
a7de2dc632
commit
702df9676c
|
@ -12,6 +12,7 @@ Development version
|
||||||
- Implement providers' lazy initialization.
|
- Implement providers' lazy initialization.
|
||||||
- Improve providers' copying.
|
- Improve providers' copying.
|
||||||
- Improve typing in wiring module.
|
- Improve typing in wiring module.
|
||||||
|
- Fix wiring module loader uninstallation issue.
|
||||||
|
|
||||||
4.30.0
|
4.30.0
|
||||||
------
|
------
|
||||||
|
|
|
@ -860,7 +860,7 @@ class AutoLoader:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def installed(self):
|
def installed(self):
|
||||||
return self._path_hook is not None
|
return self._path_hook in sys.path_hooks
|
||||||
|
|
||||||
def install(self):
|
def install(self):
|
||||||
if self.installed:
|
if self.installed:
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
import contextlib
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
import importlib
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from dependency_injector.wiring import (
|
from dependency_injector.wiring import (
|
||||||
|
@ -6,6 +8,8 @@ from dependency_injector.wiring import (
|
||||||
Provide,
|
Provide,
|
||||||
Provider,
|
Provider,
|
||||||
Closing,
|
Closing,
|
||||||
|
register_loader_containers,
|
||||||
|
unregister_loader_containers,
|
||||||
)
|
)
|
||||||
from dependency_injector import containers, providers, errors
|
from dependency_injector import containers, providers, errors
|
||||||
|
|
||||||
|
@ -409,27 +413,27 @@ class WiringAsyncInjectionsTest(AsyncTestCase):
|
||||||
self.assertEqual(asyncinjections.resource2.shutdown_counter, 2)
|
self.assertEqual(asyncinjections.resource2.shutdown_counter, 2)
|
||||||
|
|
||||||
|
|
||||||
# class AutoLoaderTest(unittest.TestCase):
|
class AutoLoaderTest(unittest.TestCase):
|
||||||
#
|
|
||||||
# container: Container
|
container: Container
|
||||||
#
|
|
||||||
# def setUp(self) -> None:
|
def setUp(self) -> None:
|
||||||
# self.container = Container(config={'a': {'b': {'c': 10}}})
|
self.container = Container(config={'a': {'b': {'c': 10}}})
|
||||||
# importlib.reload(module)
|
importlib.reload(module)
|
||||||
#
|
|
||||||
# def tearDown(self) -> None:
|
def tearDown(self) -> None:
|
||||||
# with contextlib.suppress(ValueError):
|
with contextlib.suppress(ValueError):
|
||||||
# unregister_loader_containers(self.container)
|
unregister_loader_containers(self.container)
|
||||||
#
|
|
||||||
# self.container.unwire()
|
self.container.unwire()
|
||||||
#
|
|
||||||
# @classmethod
|
@classmethod
|
||||||
# def tearDownClass(cls) -> None:
|
def tearDownClass(cls) -> None:
|
||||||
# importlib.reload(module)
|
importlib.reload(module)
|
||||||
#
|
|
||||||
# def test_register_container(self):
|
def test_register_container(self):
|
||||||
# register_loader_containers(self.container)
|
register_loader_containers(self.container)
|
||||||
# importlib.reload(module)
|
importlib.reload(module)
|
||||||
#
|
|
||||||
# service = module.test_function()
|
service = module.test_function()
|
||||||
# self.assertIsInstance(service, Service)
|
self.assertIsInstance(service, Service)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user