mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-25 02:53:56 +03:00
Add performance test for overridden providers
This commit is contained in:
parent
3a0e803e3c
commit
c2b61defb3
|
@ -74,7 +74,7 @@ class Tester(object):
|
||||||
# for x in xrange(int(5000000 * self.duration_factor)):
|
# for x in xrange(int(5000000 * self.duration_factor)):
|
||||||
# test_factory(1, 2, 3)
|
# test_factory(1, 2, 3)
|
||||||
|
|
||||||
def test_instance_3_kw_injections(self, providers):
|
def test_raw_3_kw_injections(self, providers):
|
||||||
"""Test 3 keyword argument injections."""
|
"""Test 3 keyword argument injections."""
|
||||||
class A(object):
|
class A(object):
|
||||||
pass
|
pass
|
||||||
|
@ -92,7 +92,7 @@ class Tester(object):
|
||||||
for x in xrange(int(5000000 * self.duration_factor)):
|
for x in xrange(int(5000000 * self.duration_factor)):
|
||||||
Test(a=A(), b=B(), c=C())
|
Test(a=A(), b=B(), c=C())
|
||||||
|
|
||||||
def test_instance_factory_3_factory_kw_injections(self, providers):
|
def test_factory_3_factory_kw_injections(self, providers):
|
||||||
"""Test factory with 3 keyword argument injections via factories."""
|
"""Test factory with 3 keyword argument injections via factories."""
|
||||||
class A(object):
|
class A(object):
|
||||||
pass
|
pass
|
||||||
|
@ -117,6 +117,32 @@ class Tester(object):
|
||||||
for x in xrange(int(5000000 * self.duration_factor)):
|
for x in xrange(int(5000000 * self.duration_factor)):
|
||||||
test_factory()
|
test_factory()
|
||||||
|
|
||||||
|
def test_overridden_factory_3_factory_kw_injections(self, providers):
|
||||||
|
"""Test factory with 3 keyword argument injections via factories."""
|
||||||
|
class A(object):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class B(object):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class C(object):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Test(object):
|
||||||
|
def __init__(self, a, b, c):
|
||||||
|
pass
|
||||||
|
|
||||||
|
a_factory = providers.Factory(A)
|
||||||
|
b_factory = providers.Factory(B)
|
||||||
|
c_factory = providers.Factory(C)
|
||||||
|
test_factory = providers.Factory(object)
|
||||||
|
test_factory.override(providers.Factory(Test,
|
||||||
|
a=a_factory,
|
||||||
|
b=b_factory,
|
||||||
|
c=c_factory))
|
||||||
|
for x in xrange(int(5000000 * self.duration_factor)):
|
||||||
|
test_factory()
|
||||||
|
|
||||||
# def test_factory_subcls_3_factory_subcls_kw_injections(self, providers):
|
# def test_factory_subcls_3_factory_subcls_kw_injections(self, providers):
|
||||||
# """Test factory with 3 keyword argument injections via factories."""
|
# """Test factory with 3 keyword argument injections via factories."""
|
||||||
# class MyFactory(providers.Factory):
|
# class MyFactory(providers.Factory):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user