diff --git a/avocado/core/tree.py b/avocado/core/tree.py index 36b6629f83326c31466e11123bf4fc57feacbe11..2406b39a73e4b62489fba7ca38626d00be627eee 100644 --- a/avocado/core/tree.py +++ b/avocado/core/tree.py @@ -274,7 +274,7 @@ class TreeNode(object): node = self.parent while True: if node is None: - raise StopIteration + return yield node node = node.parent diff --git a/optional_plugins/varianter_yaml_to_mux/avocado_varianter_yaml_to_mux/mux.py b/optional_plugins/varianter_yaml_to_mux/avocado_varianter_yaml_to_mux/mux.py index a7e6272cb335e7e8334f4f84461ea6a6afb702e3..d6a6cf28ef42d7b29913909091f59f14ba8632fa 100644 --- a/optional_plugins/varianter_yaml_to_mux/avocado_varianter_yaml_to_mux/mux.py +++ b/optional_plugins/varianter_yaml_to_mux/avocado_varianter_yaml_to_mux/mux.py @@ -73,7 +73,7 @@ class MuxTree(object): try: node = queue.popleft() except IndexError: - raise StopIteration + return def __iter__(self): """ @@ -101,7 +101,10 @@ class MuxTree(object): pools.append([pool]) variants = itertools.product(*pools) while True: - yield list(itertools.chain(*next(variants))) + try: + yield list(itertools.chain(*next(variants))) + except StopIteration: + return @staticmethod def _valid_variant(variant): @@ -310,7 +313,6 @@ class ValueDict(dict): # only container pylint: disable=R0903 """ Slower implementation with the use of __getitem__ """ for key in iterkeys(self): yield key, self[key] - raise StopIteration class Control(object): # Few methods pylint: disable=R0903