Fix iterable problems due to context currifier, and some examples with wrong import paths.

This commit is contained in:
Romain Dorgueil
2017-05-20 10:40:44 +02:00
parent e9e9477ef6
commit 58a1580668
11 changed files with 304 additions and 295 deletions

View File

@ -15,6 +15,7 @@ class MethodBasedConfigurable(Configurable):
def test_one_wrapper_only():
with pytest.raises(ConfigurationError):
class TwoMethods(Configurable):
h1 = Method()
h2 = Method()
@ -25,7 +26,7 @@ def test_define_with_decorator():
@MethodBasedConfigurable
def Concrete(self, *args, **kwargs):
calls.append((args, kwargs,))
calls.append((args, kwargs, ))
t = Concrete('foo', bar='baz')
assert len(calls) == 0
@ -37,19 +38,20 @@ def test_define_with_argument():
calls = []
def concrete_handler(*args, **kwargs):
calls.append((args, kwargs,))
calls.append((args, kwargs, ))
t = MethodBasedConfigurable('foo', bar='baz', handler=concrete_handler)
assert len(calls) == 0
t()
assert len(calls) == 1
def test_define_with_inheritance():
calls = []
class Inheriting(MethodBasedConfigurable):
def handler(self, *args, **kwargs):
calls.append((args, kwargs,))
calls.append((args, kwargs, ))
t = Inheriting('foo', bar='baz')
assert len(calls) == 0
@ -65,7 +67,7 @@ def test_inheritance_then_decorate():
@Inheriting
def Concrete(self, *args, **kwargs):
calls.append((args, kwargs,))
calls.append((args, kwargs, ))
t = Concrete('foo', bar='baz')
assert len(calls) == 0

View File

@ -79,4 +79,3 @@ def test_simple_execution_context():
assert not ctx.alive
assert ctx.started
assert ctx.stopped