aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/pytest/py3
diff options
context:
space:
mode:
authormaxim-yurchuk <maxim-yurchuk@yandex-team.com>2024-10-09 12:29:46 +0300
committermaxim-yurchuk <maxim-yurchuk@yandex-team.com>2024-10-09 13:14:22 +0300
commit9731d8a4bb7ee2cc8554eaf133bb85498a4c7d80 (patch)
treea8fb3181d5947c0d78cf402aa56e686130179049 /contrib/python/pytest/py3
parenta44b779cd359f06c3ebbef4ec98c6b38609d9d85 (diff)
downloadydb-9731d8a4bb7ee2cc8554eaf133bb85498a4c7d80.tar.gz
publishFullContrib: true for ydb
<HIDDEN_URL> commit_hash:c82a80ac4594723cebf2c7387dec9c60217f603e
Diffstat (limited to 'contrib/python/pytest/py3')
-rw-r--r--contrib/python/pytest/py3/.yandex_meta/yamaker.yaml2
-rw-r--r--contrib/python/pytest/py3/patches/03-limit-id.patch31
-rw-r--r--contrib/python/pytest/py3/patches/04-support-cyrillic-id.patch11
-rw-r--r--contrib/python/pytest/py3/patches/05-support-readline.patch54
-rw-r--r--contrib/python/pytest/py3/patches/06-support-ya-markers.patch14
-rw-r--r--contrib/python/pytest/py3/patches/07-disable-translate-non-printable.patch11
-rw-r--r--contrib/python/pytest/py3/patches/08-fix-collision-with-py.patch8
7 files changed, 131 insertions, 0 deletions
diff --git a/contrib/python/pytest/py3/.yandex_meta/yamaker.yaml b/contrib/python/pytest/py3/.yandex_meta/yamaker.yaml
new file mode 100644
index 0000000000..8f67972c48
--- /dev/null
+++ b/contrib/python/pytest/py3/.yandex_meta/yamaker.yaml
@@ -0,0 +1,2 @@
+exclude:
+ - py.py
diff --git a/contrib/python/pytest/py3/patches/03-limit-id.patch b/contrib/python/pytest/py3/patches/03-limit-id.patch
new file mode 100644
index 0000000000..8521549361
--- /dev/null
+++ b/contrib/python/pytest/py3/patches/03-limit-id.patch
@@ -0,0 +1,31 @@
+--- contrib/python/pytest/py3/_pytest/python.py (index)
++++ contrib/python/pytest/py3/_pytest/python.py (working tree)
+@@ -991,7 +991,7 @@ class IdMaker:
+ The counter suffix is appended only in case a string wouldn't be unique
+ otherwise.
+ """
+- resolved_ids = list(self._resolve_ids())
++ resolved_ids = list(self._limit_ids(self._resolve_ids(), limit=500))
+ # All IDs must be unique!
+ if len(resolved_ids) != len(set(resolved_ids)):
+ # Record the number of occurrences of each ID.
+@@ -1005,6 +1005,19 @@ class IdMaker:
+ id_suffixes[id] += 1
+ return resolved_ids
+
++ def _limit_ids(self, ids, limit=500):
++ prefix_count = {}
++ limit -= 6
++ assert limit > 0
++
++ for idval in ids:
++ if len(idval) > limit:
++ prefix = idval[:limit]
++ idx = prefix_count.get(prefix, -1) + 1
++ prefix_count[prefix] = idx
++ idval = "{}-{}".format(prefix, idx)
++ yield idval
++
+ def _resolve_ids(self) -> Iterable[str]:
+ """Resolve IDs for all ParameterSets (may contain duplicates)."""
+ for idx, parameterset in enumerate(self.parametersets):
diff --git a/contrib/python/pytest/py3/patches/04-support-cyrillic-id.patch b/contrib/python/pytest/py3/patches/04-support-cyrillic-id.patch
new file mode 100644
index 0000000000..e77009678e
--- /dev/null
+++ b/contrib/python/pytest/py3/patches/04-support-cyrillic-id.patch
@@ -0,0 +1,11 @@
+--- contrib/python/pytest/py3/_pytest/compat.py (index)
++++ contrib/python/pytest/py3/_pytest/compat.py (working tree)
+@@ -249,7 +249,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
new file mode 100644
index 0000000000..4e5ee9767d
--- /dev/null
+++ b/contrib/python/pytest/py3/patches/05-support-readline.patch
@@ -0,0 +1,54 @@
+--- contrib/python/pytest/py3/_pytest/debugging.py (index)
++++ contrib/python/pytest/py3/_pytest/debugging.py (working tree)
+@@ -3,2 +3,3 @@ from __future__ import absolute_import
+ import functools
++import os
+ import sys
+@@ -32,2 +33,38 @@ from _pytest import outcomes
+
++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]:
+@@ -280,2 +317,3 @@ class pytestPDB(object):
+ """Invoke debugging via ``Pdb.set_trace``, dropping any IO capturing."""
++ tty()
+ frame = sys._getframe().f_back
+@@ -295,2 +333,3 @@ class PdbInvoke(object):
+ sys.stdout.write(err)
++ tty()
+ assert call.excinfo is not None
+
diff --git a/contrib/python/pytest/py3/patches/06-support-ya-markers.patch b/contrib/python/pytest/py3/patches/06-support-ya-markers.patch
new file mode 100644
index 0000000000..8435093818
--- /dev/null
+++ b/contrib/python/pytest/py3/patches/06-support-ya-markers.patch
@@ -0,0 +1,14 @@
+--- contrib/python/pytest/py3/_pytest/mark/structures.py (index)
++++ contrib/python/pytest/py3/_pytest/mark/structures.py (working tree)
+@@ -524,7 +524,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
new file mode 100644
index 0000000000..ada62a5e60
--- /dev/null
+++ b/contrib/python/pytest/py3/patches/07-disable-translate-non-printable.patch
@@ -0,0 +1,11 @@
+--- contrib/python/pytest/py3/_pytest/compat.py (index)
++++ contrib/python/pytest/py3/_pytest/compat.py (working tree)
+@@ -250,7 +250,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-collision-with-py.patch b/contrib/python/pytest/py3/patches/08-fix-collision-with-py.patch
new file mode 100644
index 0000000000..e82591c1d5
--- /dev/null
+++ b/contrib/python/pytest/py3/patches/08-fix-collision-with-py.patch
@@ -0,0 +1,8 @@
+--- contrib/python/pytest/py3/_pytest/compat.py (index)
++++ contrib/python/pytest/py3/_pytest/compat.py (working tree)
+@@ -22,1 +22,1 @@ from typing import Union
+-import py
++import _pytest._py.path as py_path
+@@ -46,1 +46,1 @@ _S = TypeVar("_S")
+-LEGACY_PATH = py.path. local
++LEGACY_PATH = py_path. local