diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /contrib/python/pytest/py2/patches/04-fix-id-encoding.patch | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'contrib/python/pytest/py2/patches/04-fix-id-encoding.patch')
-rw-r--r-- | contrib/python/pytest/py2/patches/04-fix-id-encoding.patch | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/contrib/python/pytest/py2/patches/04-fix-id-encoding.patch b/contrib/python/pytest/py2/patches/04-fix-id-encoding.patch new file mode 100644 index 0000000000..e70af52d19 --- /dev/null +++ b/contrib/python/pytest/py2/patches/04-fix-id-encoding.patch @@ -0,0 +1,57 @@ +--- contrib/python/pytest/py2/_pytest/compat.py (index) ++++ contrib/python/pytest/py2/_pytest/compat.py (working tree) +@@ -378,7 +378,10 @@ if _PY3: + + def safe_str(v): + """returns v as string""" +- return str(v) ++ try: ++ return str(v) ++ except UnicodeEncodeError: ++ return str(v, encoding="utf-8") + + + else: +--- contrib/python/pytest/py2/_pytest/python.py (index) ++++ contrib/python/pytest/py2/_pytest/python.py (working tree) +@@ -896,7 +896,7 @@ class CallSpec2(object): + + @property + def id(self): +- return "-".join(map(str, filter(None, self._idlist))) ++ return "-".join(map(safe_str, filter(None, self._idlist))) + + def setmulti2(self, valtypes, argnames, valset, id, marks, scopenum, param_index): + for arg, val in zip(argnames, valset): +@@ -1218,10 +1218,10 @@ def limit_idval(limit): + if len(idval) > limit: + prefix = idval[:limit] + # There might be same prefix for the different test cases - take item into account +- name = "{}-{}".format(kw.get('item', ''), prefix) ++ name = "{}-{}".format(kw.get('item', ''), safe_str(prefix)) + idx = names.setdefault(name, -1) + 1 + names[name] = idx +- idval = "{}-{}".format(prefix, idx) ++ idval = "{}-{}".format(safe_str(prefix), idx) + return idval + + return wrapper +--- contrib/python/pytest/py2/_pytest/runner.py (index) ++++ contrib/python/pytest/py2/_pytest/runner.py (working tree) +@@ -16,6 +16,7 @@ from .reports import CollectErrorRepr + from .reports import CollectReport + from .reports import TestReport + from _pytest._code.code import ExceptionInfo ++from _pytest.compat import safe_str + from _pytest.outcomes import Exit + from _pytest.outcomes import Skipped + from _pytest.outcomes import TEST_OUTCOME +@@ -241,7 +242,7 @@ class CallInfo(object): + value = repr(self._result) + status = "result" + return "<CallInfo when={when!r} {status}: {value}>".format( +- when=self.when, value=value, status=status ++ when=self.when, value=safe_str(value), status=status + ) + + |