diff options
author | Martin Klozik <martinx.klozik@intel.com> | 2017-12-14 11:22:18 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-12-14 11:22:18 +0000 |
commit | a392e7361cb698d9b804a79978d9c7a3a83e58fc (patch) | |
tree | efee5eede850e6c75a5c5142f7f6ff21869fd16d /tools/functions.py | |
parent | d1270fb092fda14e02a306cfe7af160b45b2677c (diff) | |
parent | b830a59fc8c05a92b874252cb8f6cb96ded46bb5 (diff) |
Merge "teststeps: Improvements of step driven TC"
Diffstat (limited to 'tools/functions.py')
-rw-r--r-- | tools/functions.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/tools/functions.py b/tools/functions.py index c0d1e5f7..d35f1f84 100644 --- a/tools/functions.py +++ b/tools/functions.py @@ -190,17 +190,15 @@ def filter_output(output, regex): """ result = [] if isinstance(output, str): - for line in output.split('\n'): + for line in output.splitlines(): result += re.findall(regex, line) - return result - elif isinstance(output, list) or isinstance(output, tuple): - tmp_res = [] + elif isinstance(output, (list, tuple)): for item in output: - tmp_res.append(filter_output(item, regex)) - return tmp_res + result.append(filter_output(item, regex)) else: raise RuntimeError('Only strings and lists are supported by filter_output(), ' 'but output has type {}'.format(type(output))) + return result def format_description(desc, length): """ Split description into multiple lines based on given line length. |