aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/pytest/py3
diff options
context:
space:
mode:
authorAleksandr <ivansduck@gmail.com>2022-02-10 16:47:52 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:52 +0300
commitb05913d1c3c02a773578bceb7285084d2933ae86 (patch)
treec0748b5dcbade83af788c0abfa89c0383d6b779c /contrib/python/pytest/py3
parentea6c5b7f172becca389cacaff7d5f45f6adccbe6 (diff)
downloadydb-b05913d1c3c02a773578bceb7285084d2933ae86.tar.gz
Restoring authorship annotation for Aleksandr <ivansduck@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'contrib/python/pytest/py3')
-rw-r--r--contrib/python/pytest/py3/_pytest/python.py50
1 files changed, 25 insertions, 25 deletions
diff --git a/contrib/python/pytest/py3/_pytest/python.py b/contrib/python/pytest/py3/_pytest/python.py
index 01011cbc15..f1a47d7d33 100644
--- a/contrib/python/pytest/py3/_pytest/python.py
+++ b/contrib/python/pytest/py3/_pytest/python.py
@@ -1339,33 +1339,33 @@ def _idval(
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
+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
+ 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)
+ 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,