def test_get_function_path(self): self.assertEqual(get_function_path(local_function), 'uwsgi_tasks.tests.local_function') self.assertEqual(get_function_path(len), '{}.len'.format(self.builtin_module)) def nested(): pass self.assertEqual(get_function_path(nested), 'uwsgi_tasks.tests.nested')
def test_get_function_path(self): self.assertEquals(get_function_path(local_function), 'uwsgi_tasks.tests.local_function') self.assertEqual(get_function_path(len), '__builtin__.len') def nested(): pass self.assertEquals(get_function_path(nested), 'uwsgi_tasks.tests.nested')
def __init__(self, func, executor=TaskExecutor.AUTO, **setup): assert callable(func) self.function = func self.function_name = get_function_path(self.function) self.executor = executor self.setup = setup self._add_to_global_storage()
def test_get_function_path(self): self.assertEquals( get_function_path(local_function), 'uwsgi_tasks.tests.local_function' ) self.assertEqual( get_function_path(len), '__builtin__.len' ) def nested(): pass self.assertEquals( get_function_path(nested), 'uwsgi_tasks.tests.nested' )
def __init__(self, function, **setup): self._function = None if isinstance(function, basestring): self.function_name = function elif callable(function): self._function = function self.function_name = get_function_path(function) else: raise TypeError('Callable or dotted path must be provided ' 'as first argument') self.args = setup.pop('args', ()) self.kwargs = setup.pop('kwargs', {}) self.setup = setup or {}
def __init__(self, function, **setup): self._function = None if isinstance(function, six.string_types): self.function_name = function elif callable(function): self._function = function self.function_name = get_function_path(function) else: raise TypeError('Callable or dotted path must be provided ' 'as first argument') self.args = setup.pop('args', ()) self.kwargs = setup.pop('kwargs', {}) self.setup = setup or {} self.setup.setdefault('working_dir', os.getcwd()) self._buffer = None