aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/pytest/py3/patches
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:30 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:30 +0300
commit2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch)
tree012bb94d777798f1f56ac1cec429509766d05181 /contrib/python/pytest/py3/patches
parent6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff)
downloadydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/pytest/py3/patches')
-rw-r--r--contrib/python/pytest/py3/patches/03-limit-id.patch72
-rw-r--r--contrib/python/pytest/py3/patches/04-support-cyrillic-id.patch22
-rw-r--r--contrib/python/pytest/py3/patches/05-support-readline.patch138
-rw-r--r--contrib/python/pytest/py3/patches/06-support-ya-markers.patch28
-rw-r--r--contrib/python/pytest/py3/patches/07-disable-translate-non-printable.patch22
-rw-r--r--contrib/python/pytest/py3/patches/08-fix-win-peerdir.patch30
6 files changed, 156 insertions, 156 deletions
diff --git a/contrib/python/pytest/py3/patches/03-limit-id.patch b/contrib/python/pytest/py3/patches/03-limit-id.patch
index f0a57f8599..02be83e7f5 100644
--- a/contrib/python/pytest/py3/patches/03-limit-id.patch
+++ b/contrib/python/pytest/py3/patches/03-limit-id.patch
@@ -1,36 +1,36 @@
---- contrib/python/pytest/py3/_pytest/python.py (index)
-+++ contrib/python/pytest/py3/_pytest/python.py (working tree)
-@@ -1339,6 +1339,33 @@ def _idval(val, argname, idx, idfn, item, config):
- return str(argname) + str(idx)
-
-
-+def limit_idval(limit):
-+ import functools
-+
-+ names = {}
-+ limit -= 6
-+ assert limit > 0
-+
-+ def decorator(func):
-+ @functools.wraps(func)
-+ def wrapper(*args, **kw):
-+ idval = func(*args, **kw)
-+ 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)
-+ idx = names.setdefault(name, -1) + 1
-+ names[name] = idx
-+ idval = "{}-{}".format(prefix, idx)
-+ return idval
-+
-+ return wrapper
-+
-+ return decorator
-+
-+
-+# XXX limit testnames in the name of sanity and readability
-+@limit_idval(limit=500)
- def _idvalset(
- idx: int,
- parameterset: ParameterSet,
+--- contrib/python/pytest/py3/_pytest/python.py (index)
++++ contrib/python/pytest/py3/_pytest/python.py (working tree)
+@@ -1339,6 +1339,33 @@ def _idval(val, argname, idx, idfn, item, config):
+ return str(argname) + str(idx)
+
+
++def limit_idval(limit):
++ import functools
++
++ names = {}
++ limit -= 6
++ assert limit > 0
++
++ def decorator(func):
++ @functools.wraps(func)
++ def wrapper(*args, **kw):
++ idval = func(*args, **kw)
++ 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)
++ idx = names.setdefault(name, -1) + 1
++ names[name] = idx
++ idval = "{}-{}".format(prefix, idx)
++ return idval
++
++ return wrapper
++
++ return decorator
++
++
++# XXX limit testnames in the name of sanity and readability
++@limit_idval(limit=500)
+ def _idvalset(
+ idx: int,
+ parameterset: ParameterSet,
diff --git a/contrib/python/pytest/py3/patches/04-support-cyrillic-id.patch b/contrib/python/pytest/py3/patches/04-support-cyrillic-id.patch
index c601f183f9..f7546bf1df 100644
--- a/contrib/python/pytest/py3/patches/04-support-cyrillic-id.patch
+++ b/contrib/python/pytest/py3/patches/04-support-cyrillic-id.patch
@@ -1,11 +1,11 @@
---- contrib/python/pytest/py3/_pytest/compat.py (index)
-+++ contrib/python/pytest/py3/_pytest/compat.py (working tree)
-@@ -233,7 +233,7 @@ if _PY3:
- if isinstance(val, bytes):
- ret = _bytes_to_ascii(val)
- else:
-- ret = val.encode("unicode_escape").decode("ascii")
-+ ret = val
- return _translate_non_printable(ret)
-
-
+--- contrib/python/pytest/py3/_pytest/compat.py (index)
++++ contrib/python/pytest/py3/_pytest/compat.py (working tree)
+@@ -233,7 +233,7 @@ if _PY3:
+ if isinstance(val, bytes):
+ ret = _bytes_to_ascii(val)
+ else:
+- ret = val.encode("unicode_escape").decode("ascii")
++ ret = val
+ return _translate_non_printable(ret)
+
+
diff --git a/contrib/python/pytest/py3/patches/05-support-readline.patch b/contrib/python/pytest/py3/patches/05-support-readline.patch
index 0f77979192..07f4748037 100644
--- a/contrib/python/pytest/py3/patches/05-support-readline.patch
+++ b/contrib/python/pytest/py3/patches/05-support-readline.patch
@@ -1,69 +1,69 @@
---- contrib/python/pytest/py3/_pytest/debugging.py (index)
-+++ contrib/python/pytest/py3/_pytest/debugging.py (working tree)
-@@ -1,6 +1,7 @@ from __future__ import absolute_import
- """Interactive debugging with PDB, the Python Debugger."""
- import argparse
- import functools
-+import os
- import sys
- import types
- from typing import Any
-@@ -29,6 +30,42 @@ from _pytest import outcomes
- from _pytest.runner import CallInfo
-
-
-+def import_readline():
-+ try:
-+ import readline
-+ except ImportError:
-+ sys.path.append('/usr/lib/python2.7/lib-dynload')
-+
-+ try:
-+ import readline
-+ except ImportError as e:
-+ print('can not import readline:', e)
-+
-+ import subprocess
-+ try:
-+ subprocess.check_call('stty icrnl'.split())
-+ except OSError as e:
-+ print('can not restore Enter, use Control+J:', e)
-+
-+
-+def tty():
-+ if os.isatty(1):
-+ return
-+
-+ fd = os.open('/dev/tty', os.O_RDWR)
-+ os.dup2(fd, 0)
-+ os.dup2(fd, 1)
-+ os.dup2(fd, 2)
-+ os.close(fd)
-+
-+ old_sys_path = sys.path
-+ sys.path = list(sys.path)
-+ try:
-+ import_readline()
-+ finally:
-+ sys.path = old_sys_path
-+
-+
- def _validate_usepdb_cls(value: str) -> Tuple[str, str]:
- """Validate syntax of --pdbcls option."""
- try:
-@@ -277,6 +314,7 @@ class pytestPDB(object):
- @classmethod
- def set_trace(cls, *args, **kwargs) -> None:
- """Invoke debugging via ``Pdb.set_trace``, dropping any IO capturing."""
-+ tty()
- frame = sys._getframe().f_back
- _pdb = cls._init_pdb("set_trace", *args, **kwargs)
- _pdb.set_trace(frame)
-@@ -292,6 +330,7 @@ class PdbInvoke(object):
- out, err = capman.read_global_capture()
- sys.stdout.write(out)
- sys.stdout.write(err)
-+ tty()
- assert call.excinfo is not None
- _enter_pdb(node, call.excinfo, report)
-
+--- contrib/python/pytest/py3/_pytest/debugging.py (index)
++++ contrib/python/pytest/py3/_pytest/debugging.py (working tree)
+@@ -1,6 +1,7 @@ from __future__ import absolute_import
+ """Interactive debugging with PDB, the Python Debugger."""
+ import argparse
+ import functools
++import os
+ import sys
+ import types
+ from typing import Any
+@@ -29,6 +30,42 @@ from _pytest import outcomes
+ from _pytest.runner import CallInfo
+
+
++def import_readline():
++ try:
++ import readline
++ except ImportError:
++ sys.path.append('/usr/lib/python2.7/lib-dynload')
++
++ try:
++ import readline
++ except ImportError as e:
++ print('can not import readline:', e)
++
++ import subprocess
++ try:
++ subprocess.check_call('stty icrnl'.split())
++ except OSError as e:
++ print('can not restore Enter, use Control+J:', e)
++
++
++def tty():
++ if os.isatty(1):
++ return
++
++ fd = os.open('/dev/tty', os.O_RDWR)
++ os.dup2(fd, 0)
++ os.dup2(fd, 1)
++ os.dup2(fd, 2)
++ os.close(fd)
++
++ old_sys_path = sys.path
++ sys.path = list(sys.path)
++ try:
++ import_readline()
++ finally:
++ sys.path = old_sys_path
++
++
+ def _validate_usepdb_cls(value: str) -> Tuple[str, str]:
+ """Validate syntax of --pdbcls option."""
+ try:
+@@ -277,6 +314,7 @@ class pytestPDB(object):
+ @classmethod
+ def set_trace(cls, *args, **kwargs) -> None:
+ """Invoke debugging via ``Pdb.set_trace``, dropping any IO capturing."""
++ tty()
+ frame = sys._getframe().f_back
+ _pdb = cls._init_pdb("set_trace", *args, **kwargs)
+ _pdb.set_trace(frame)
+@@ -292,6 +330,7 @@ class PdbInvoke(object):
+ out, err = capman.read_global_capture()
+ sys.stdout.write(out)
+ sys.stdout.write(err)
++ tty()
+ assert call.excinfo is not None
+ _enter_pdb(node, call.excinfo, report)
+
diff --git a/contrib/python/pytest/py3/patches/06-support-ya-markers.patch b/contrib/python/pytest/py3/patches/06-support-ya-markers.patch
index 0726477fe8..62f82a8981 100644
--- a/contrib/python/pytest/py3/patches/06-support-ya-markers.patch
+++ b/contrib/python/pytest/py3/patches/06-support-ya-markers.patch
@@ -1,14 +1,14 @@
---- contrib/python/pytest/py3/_pytest/mark/structures.py (index)
-+++ contrib/python/pytest/py3/_pytest/mark/structures.py (working tree)
-@@ -490,7 +490,10 @@ class MarkGenerator(object):
- # example lines: "skipif(condition): skip the given test if..."
- # or "hypothesis: tests which use Hypothesis", so to get the
- # marker name we split on both `:` and `(`.
-- marker = line.split(":")[0].split("(")[0].strip()
-+ if line == "ya:external":
-+ marker = line
-+ else:
-+ marker = line.split(":")[0].split("(")[0].strip()
- self._markers.add(marker)
-
- # If the name is not in the set of known marks after updating,
+--- contrib/python/pytest/py3/_pytest/mark/structures.py (index)
++++ contrib/python/pytest/py3/_pytest/mark/structures.py (working tree)
+@@ -490,7 +490,10 @@ class MarkGenerator(object):
+ # example lines: "skipif(condition): skip the given test if..."
+ # or "hypothesis: tests which use Hypothesis", so to get the
+ # marker name we split on both `:` and `(`.
+- marker = line.split(":")[0].split("(")[0].strip()
++ if line == "ya:external":
++ marker = line
++ else:
++ marker = line.split(":")[0].split("(")[0].strip()
+ self._markers.add(marker)
+
+ # If the name is not in the set of known marks after updating,
diff --git a/contrib/python/pytest/py3/patches/07-disable-translate-non-printable.patch b/contrib/python/pytest/py3/patches/07-disable-translate-non-printable.patch
index dd81a883e8..5ac6294dd0 100644
--- a/contrib/python/pytest/py3/patches/07-disable-translate-non-printable.patch
+++ b/contrib/python/pytest/py3/patches/07-disable-translate-non-printable.patch
@@ -1,11 +1,11 @@
---- contrib/python/pytest/py3/_pytest/compat.py (index)
-+++ contrib/python/pytest/py3/_pytest/compat.py (working tree)
-@@ -234,7 +234,7 @@ if _PY3:
- ret = _bytes_to_ascii(val)
- else:
- ret = val
-- return _translate_non_printable(ret)
-+ return ret
-
-
- @attr.s
+--- contrib/python/pytest/py3/_pytest/compat.py (index)
++++ contrib/python/pytest/py3/_pytest/compat.py (working tree)
+@@ -234,7 +234,7 @@ if _PY3:
+ ret = _bytes_to_ascii(val)
+ else:
+ ret = val
+- return _translate_non_printable(ret)
++ return ret
+
+
+ @attr.s
diff --git a/contrib/python/pytest/py3/patches/08-fix-win-peerdir.patch b/contrib/python/pytest/py3/patches/08-fix-win-peerdir.patch
index d6a56ef6e0..35cd692edb 100644
--- a/contrib/python/pytest/py3/patches/08-fix-win-peerdir.patch
+++ b/contrib/python/pytest/py3/patches/08-fix-win-peerdir.patch
@@ -1,15 +1,15 @@
---- contrib/python/pytest/py3/ya.make (index)
-+++ contrib/python/pytest/py3/ya.make (working tree)
-@@ -15,6 +15,12 @@ PEERDIR(
- contrib/python/wcwidth
- )
-
-+IF (OS_WINDOWS)
-+ PEERDIR(
-+ contrib/python/atomicwrites
-+ )
-+ENDIF()
-+
- NO_LINT()
-
- NO_CHECK_IMPORTS(
+--- contrib/python/pytest/py3/ya.make (index)
++++ contrib/python/pytest/py3/ya.make (working tree)
+@@ -15,6 +15,12 @@ PEERDIR(
+ contrib/python/wcwidth
+ )
+
++IF (OS_WINDOWS)
++ PEERDIR(
++ contrib/python/atomicwrites
++ )
++ENDIF()
++
+ NO_LINT()
+
+ NO_CHECK_IMPORTS(