[qa] removes a bunch of unused code.
This commit is contained in:
@ -20,10 +20,8 @@ def get_default_services(filename, services=None):
|
||||
'__name__': '__bonobo__',
|
||||
'__file__': services_filename,
|
||||
}
|
||||
try:
|
||||
exec(code, context)
|
||||
except Exception:
|
||||
raise
|
||||
exec(code, context)
|
||||
|
||||
return {
|
||||
**context[DEFAULT_SERVICES_ATTR](),
|
||||
**(services or {}),
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import types
|
||||
from collections import Iterable
|
||||
from contextlib import contextmanager
|
||||
|
||||
@ -132,14 +131,7 @@ def resolve_processors(mixed):
|
||||
try:
|
||||
yield from mixed.__processors__
|
||||
except AttributeError:
|
||||
# old code, deprecated usage
|
||||
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 ()
|
||||
yield from ()
|
||||
|
||||
|
||||
get_context_processors = deprecated_alias('get_context_processors', resolve_processors)
|
||||
|
||||
@ -83,6 +83,7 @@ class Container(dict):
|
||||
'Cannot resolve service {!r} using provided service collection.'.format(name)
|
||||
)
|
||||
value = super().get(name)
|
||||
# XXX this is not documented and can lead to errors.
|
||||
if isinstance(value, types.LambdaType):
|
||||
value = value(self)
|
||||
return value
|
||||
|
||||
@ -28,8 +28,6 @@ def test_define_with_decorator():
|
||||
def Concrete(self, *args, **kwargs):
|
||||
calls.append((args, kwargs, ))
|
||||
|
||||
print('handler', Concrete.handler)
|
||||
|
||||
assert callable(Concrete.handler)
|
||||
t = Concrete('foo', bar='baz')
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import types
|
||||
import inspect
|
||||
|
||||
|
||||
def test_wildcard_import():
|
||||
@ -10,7 +10,7 @@ def test_wildcard_import():
|
||||
if name.startswith('_'):
|
||||
continue
|
||||
attr = getattr(bonobo, name)
|
||||
if isinstance(attr, types.ModuleType):
|
||||
if inspect.ismodule(attr):
|
||||
continue
|
||||
|
||||
assert name in bonobo.__all__
|
||||
|
||||
Reference in New Issue
Block a user