tests: Fix WaitForOneFromTask constructor parameter introspection
Strings are iterable, so the check in WaitForOneFromTask was effectively useless. This lead to TypeErrors (caught by transition notifier) when it tried to find None in 'task1'. Change-Id: I3e91029f7b7cb960d6ca84490de76b5e044bc238
This commit is contained in:
@@ -15,11 +15,10 @@
|
||||
# under the License.
|
||||
|
||||
import contextlib
|
||||
|
||||
import collections
|
||||
import six
|
||||
import threading
|
||||
|
||||
import six
|
||||
|
||||
from taskflow import exceptions
|
||||
from taskflow.persistence.backends import impl_memory
|
||||
from taskflow import retry
|
||||
@@ -317,11 +316,11 @@ class WaitForOneFromTask(SaveOrderTask):
|
||||
|
||||
def __init__(self, name, wait_for, wait_states, **kwargs):
|
||||
super(WaitForOneFromTask, self).__init__(name, **kwargs)
|
||||
if not isinstance(wait_for, collections.Iterable):
|
||||
if isinstance(wait_for, six.string_types):
|
||||
self.wait_for = [wait_for]
|
||||
else:
|
||||
self.wait_for = wait_for
|
||||
if not isinstance(wait_states, collections.Iterable):
|
||||
if isinstance(wait_states, six.string_types):
|
||||
self.wait_states = [wait_states]
|
||||
else:
|
||||
self.wait_states = wait_states
|
||||
|
||||
@@ -396,7 +396,8 @@ class TransitionNotifier(object):
|
||||
callback(state, *args, **kwargs)
|
||||
except Exception:
|
||||
LOG.warn("Failure calling callback %s to notify about state"
|
||||
" transition %s", callback, state, exc_info=True)
|
||||
" transition %s, details: %s",
|
||||
callback, state, details, exc_info=True)
|
||||
|
||||
def register(self, state, callback, args=None, kwargs=None):
|
||||
assert six.callable(callback), "Callback must be callable"
|
||||
|
||||
Reference in New Issue
Block a user