From cfd3897addacd008778d9460517af3b5255d4b73 Mon Sep 17 00:00:00 2001 From: RockBomber Date: Thu, 13 Jul 2017 15:47:49 +0300 Subject: [PATCH] Update utils.py: change str to unicode for Py 2.7 Update utils.py: change str to unicode for Python 2.7 It's needed for avoid UnicodeEncodeError when function that decorated with allure.step receiving argument in unicode --- allure-python-commons/src/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/allure-python-commons/src/utils.py b/allure-python-commons/src/utils.py index c16fcc35..397ab828 100644 --- a/allure-python-commons/src/utils.py +++ b/allure-python-commons/src/utils.py @@ -25,9 +25,11 @@ def func_parameters(func, *a, **kw): if sys.version_info.major < 3: all_names = inspect.getargspec(func).args defaults = inspect.getargspec(func).defaults + args_part = [(n, unicode(v)) for n, v in zip(all_names, a)] + kwarg_part = [(n, unicode(kw[n]) if n in kw else unicode(defaults[i])) for i, n in enumerate(all_names[len(a):])] else: all_names = inspect.getfullargspec(func).args defaults = inspect.getfullargspec(func).defaults - args_part = [(n, str(v)) for n, v in zip(all_names, a)] - kwarg_part = [(n, str(kw[n]) if n in kw else str(defaults[i])) for i, n in enumerate(all_names[len(a):])] + args_part = [(n, str(v)) for n, v in zip(all_names, a)] + kwarg_part = [(n, str(kw[n]) if n in kw else str(defaults[i])) for i, n in enumerate(all_names[len(a):])] return args_part + kwarg_part