aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/pytest/py3/patches/03-limit-id.patch
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/patches/03-limit-id.patch
parenta44b779cd359f06c3ebbef4ec98c6b38609d9d85 (diff)
downloadydb-9731d8a4bb7ee2cc8554eaf133bb85498a4c7d80.tar.gz
publishFullContrib: true for ydb
<HIDDEN_URL> commit_hash:c82a80ac4594723cebf2c7387dec9c60217f603e
Diffstat (limited to 'contrib/python/pytest/py3/patches/03-limit-id.patch')
-rw-r--r--contrib/python/pytest/py3/patches/03-limit-id.patch31
1 files changed, 31 insertions, 0 deletions
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):