aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/pytest/py3/patches
diff options
context:
space:
mode:
authorarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-03-14 14:36:14 +0300
committerarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-03-14 14:36:14 +0300
commite55fb55efda71cea0cd9c5fdafa41af406aef5bf (patch)
tree664dd8ed9a31584f9373593983273c9de2f13e7b /contrib/python/pytest/py3/patches
parent95e3624686fdca2887aa10594ee976cfddd32e38 (diff)
downloadydb-e55fb55efda71cea0cd9c5fdafa41af406aef5bf.tar.gz
intermediate changes
ref:8379e897e1f4fa0d71bb778a7c8bc68cb5e2f5ea
Diffstat (limited to 'contrib/python/pytest/py3/patches')
-rw-r--r--contrib/python/pytest/py3/patches/03-limit-id.patch51
-rw-r--r--contrib/python/pytest/py3/patches/04-support-cyrillic-id.patch2
-rw-r--r--contrib/python/pytest/py3/patches/06-support-ya-markers.patch2
-rw-r--r--contrib/python/pytest/py3/patches/07-disable-translate-non-printable.patch2
4 files changed, 26 insertions, 31 deletions
diff --git a/contrib/python/pytest/py3/patches/03-limit-id.patch b/contrib/python/pytest/py3/patches/03-limit-id.patch
index 16abfefa35..e9dccc7e12 100644
--- a/contrib/python/pytest/py3/patches/03-limit-id.patch
+++ b/contrib/python/pytest/py3/patches/03-limit-id.patch
@@ -1,36 +1,31 @@
--- contrib/python/pytest/py3/_pytest/python.py (index)
+++ contrib/python/pytest/py3/_pytest/python.py (working tree)
-@@ -1403,6 +1403,33 @@ def _idval(val, argname, idx, idfn, item, config):
- return str(argname) + str(idx)
+@@ -963,7 +963,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.
+@@ -977,6 +977,19 @@ class IdMaker:
+ id_suffixes[id] += 1
+ return resolved_ids
-
-+def limit_idval(limit):
-+ import functools
-+
-+ names = {}
-+ limit -= 6
-+ assert limit > 0
++ def _limit_ids(self, ids, limit=500):
++ prefix_count = {}
++ limit -= 6
++ assert limit > 0
+
-+ def decorator(func):
-+ @functools.wraps(func)
-+ def wrapper(*args, **kw):
-+ idval = func(*args, **kw)
++ for idval in ids:
+ 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
++ idx = prefix_count.get(prefix, -1) + 1
++ prefix_count[prefix] = idx
+ idval = "{}-{}".format(prefix, idx)
-+ return idval
-+
-+ return wrapper
-+
-+ return decorator
-+
++ yield idval
+
-+# XXX limit testnames in the name of sanity and readability
-+@limit_idval(limit=500)
- def _idvalset(
- idx: int,
- parameterset: ParameterSet,
+ 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
index 5cb6a61d61..dccd656020 100644
--- a/contrib/python/pytest/py3/patches/04-support-cyrillic-id.patch
+++ b/contrib/python/pytest/py3/patches/04-support-cyrillic-id.patch
@@ -1,6 +1,6 @@
--- contrib/python/pytest/py3/_pytest/compat.py (index)
+++ contrib/python/pytest/py3/_pytest/compat.py (working tree)
-@@ -248,7 +248,7 @@ if _PY3:
+@@ -236,7 +236,7 @@ if _PY3:
if isinstance(val, bytes):
ret = _bytes_to_ascii(val)
else:
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 c71f914537..c5ba0d7a90 100644
--- a/contrib/python/pytest/py3/patches/06-support-ya-markers.patch
+++ b/contrib/python/pytest/py3/patches/06-support-ya-markers.patch
@@ -1,6 +1,6 @@
--- contrib/python/pytest/py3/_pytest/mark/structures.py (index)
+++ contrib/python/pytest/py3/_pytest/mark/structures.py (working tree)
-@@ -506,7 +506,10 @@ class MarkGenerator(object):
+@@ -501,7 +501,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 `(`.
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 72fe70220b..b6f78704f5 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,6 +1,6 @@
--- contrib/python/pytest/py3/_pytest/compat.py (index)
+++ contrib/python/pytest/py3/_pytest/compat.py (working tree)
-@@ -249,7 +249,7 @@ if _PY3:
+@@ -237,7 +237,7 @@ if _PY3:
ret = _bytes_to_ascii(val)
else:
ret = val