[qa] removes a bunch of unused code.

This commit is contained in:
Romain Dorgueil
2017-05-22 22:34:33 +02:00
parent 1ba31191ee
commit 02e038b4b3
5 changed files with 6 additions and 17 deletions

View File

@ -20,10 +20,8 @@ def get_default_services(filename, services=None):
'__name__': '__bonobo__', '__name__': '__bonobo__',
'__file__': services_filename, '__file__': services_filename,
} }
try: exec(code, context)
exec(code, context)
except Exception:
raise
return { return {
**context[DEFAULT_SERVICES_ATTR](), **context[DEFAULT_SERVICES_ATTR](),
**(services or {}), **(services or {}),

View File

@ -1,4 +1,3 @@
import types
from collections import Iterable from collections import Iterable
from contextlib import contextmanager from contextlib import contextmanager
@ -132,14 +131,7 @@ def resolve_processors(mixed):
try: try:
yield from mixed.__processors__ yield from mixed.__processors__
except AttributeError: except AttributeError:
# old code, deprecated usage yield from ()
if isinstance(mixed, types.FunctionType):
yield from getattr(mixed, _CONTEXT_PROCESSORS_ATTR, ())
for cls in reversed((mixed if isinstance(mixed, type) else type(mixed)).__mro__):
yield from cls.__dict__.get(_CONTEXT_PROCESSORS_ATTR, ())
return ()
get_context_processors = deprecated_alias('get_context_processors', resolve_processors) get_context_processors = deprecated_alias('get_context_processors', resolve_processors)

View File

@ -83,6 +83,7 @@ class Container(dict):
'Cannot resolve service {!r} using provided service collection.'.format(name) 'Cannot resolve service {!r} using provided service collection.'.format(name)
) )
value = super().get(name) value = super().get(name)
# XXX this is not documented and can lead to errors.
if isinstance(value, types.LambdaType): if isinstance(value, types.LambdaType):
value = value(self) value = value(self)
return value return value

View File

@ -28,8 +28,6 @@ def test_define_with_decorator():
def Concrete(self, *args, **kwargs): def Concrete(self, *args, **kwargs):
calls.append((args, kwargs, )) calls.append((args, kwargs, ))
print('handler', Concrete.handler)
assert callable(Concrete.handler) assert callable(Concrete.handler)
t = Concrete('foo', bar='baz') t = Concrete('foo', bar='baz')

View File

@ -1,4 +1,4 @@
import types import inspect
def test_wildcard_import(): def test_wildcard_import():
@ -10,7 +10,7 @@ def test_wildcard_import():
if name.startswith('_'): if name.startswith('_'):
continue continue
attr = getattr(bonobo, name) attr = getattr(bonobo, name)
if isinstance(attr, types.ModuleType): if inspect.ismodule(attr):
continue continue
assert name in bonobo.__all__ assert name in bonobo.__all__