Merge "adding check for str/unicode type in requires"
This commit is contained in:
@@ -100,7 +100,10 @@ def _build_arg_mapping(atom_name, reqs, rebind_args, function, do_infer,
|
||||
required = {}
|
||||
# add reqs to required mappings
|
||||
if reqs:
|
||||
required.update((a, a) for a in reqs)
|
||||
if isinstance(reqs, six.string_types):
|
||||
required.update({reqs: reqs})
|
||||
else:
|
||||
required.update((a, a) for a in reqs)
|
||||
|
||||
# add req_args to required mappings if do_infer is set
|
||||
if do_infer:
|
||||
|
||||
@@ -149,6 +149,16 @@ class ArgumentsPassingTest(utils.EngineTestBase):
|
||||
utils.TaskOneArg,
|
||||
rebind=object())
|
||||
|
||||
def test_long_arg_name(self):
|
||||
flow = utils.LongArgNameTask(requires='long_arg_name',
|
||||
provides='result')
|
||||
engine = self._make_engine(flow)
|
||||
engine.storage.inject({'long_arg_name': 1})
|
||||
engine.run()
|
||||
self.assertEqual(engine.storage.fetch_all(), {
|
||||
'long_arg_name': 1, 'result': 1
|
||||
})
|
||||
|
||||
|
||||
class SingleThreadedEngineTest(ArgumentsPassingTest,
|
||||
test.TestCase):
|
||||
|
||||
@@ -34,7 +34,7 @@ class TestWorker(test.MockTestCase):
|
||||
self.exchange = 'test-exchange'
|
||||
self.topic = 'test-topic'
|
||||
self.threads_count = 5
|
||||
self.endpoint_count = 22
|
||||
self.endpoint_count = 23
|
||||
|
||||
# patch classes
|
||||
self.executor_mock, self.executor_inst_mock = self.patchClass(
|
||||
|
||||
@@ -95,6 +95,12 @@ class FakeTask(object):
|
||||
pass
|
||||
|
||||
|
||||
class LongArgNameTask(task.Task):
|
||||
|
||||
def execute(self, long_arg_name):
|
||||
return long_arg_name
|
||||
|
||||
|
||||
if six.PY3:
|
||||
RUNTIME_ERROR_CLASSES = ['RuntimeError', 'Exception',
|
||||
'BaseException', 'object']
|
||||
|
||||
Reference in New Issue
Block a user