mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-02-27 17:25:03 +03:00
Speed up wiring tests
This commit is contained in:
parent
aa9fbb3b3d
commit
a80e027c51
13
tests/unit/samples/wiringsamples/imports.py
Normal file
13
tests/unit/samples/wiringsamples/imports.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
"""Test module for wiring."""
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if 'pypy' not in sys.version.lower():
|
||||||
|
import numpy # noqa
|
||||||
|
from numpy import * # noqa
|
||||||
|
|
||||||
|
import scipy # noqa
|
||||||
|
from scipy import * # noqa
|
||||||
|
|
||||||
|
import builtins # noqa
|
||||||
|
from builtins import * # noqa
|
|
@ -1,7 +1,6 @@
|
||||||
"""Test module for wiring."""
|
"""Test module for wiring."""
|
||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
import sys
|
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
from dependency_injector import providers
|
from dependency_injector import providers
|
||||||
|
@ -129,16 +128,3 @@ def test_class_decorator(service: Service = Provide[Container.service]):
|
||||||
|
|
||||||
def test_container(container: Container = Provide[Container]):
|
def test_container(container: Container = Provide[Container]):
|
||||||
return container.service()
|
return container.service()
|
||||||
|
|
||||||
|
|
||||||
# Import tests
|
|
||||||
|
|
||||||
if 'pypy' not in sys.version.lower():
|
|
||||||
import numpy # noqa
|
|
||||||
from numpy import * # noqa
|
|
||||||
|
|
||||||
import scipy # noqa
|
|
||||||
from scipy import * # noqa
|
|
||||||
|
|
||||||
import builtins # noqa
|
|
||||||
from builtins import * # noqa
|
|
||||||
|
|
|
@ -437,6 +437,7 @@ class AutoLoaderTest(unittest.TestCase):
|
||||||
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)
|
||||||
|
importlib.import_module('wiringsamples.imports')
|
||||||
|
|
||||||
service = module.test_function()
|
service = module.test_function()
|
||||||
self.assertIsInstance(service, Service)
|
self.assertIsInstance(service, Service)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user