diff options
author | Aleksandr <ivansduck@gmail.com> | 2022-02-10 16:47:52 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:52 +0300 |
commit | ea6c5b7f172becca389cacaff7d5f45f6adccbe6 (patch) | |
tree | d16cef493ac1e092b4a03ab9437ec06ffe3d188f /contrib/python/pytest | |
parent | 37de222addabbef336dcaaea5f7c7645a629fc6d (diff) | |
download | ydb-ea6c5b7f172becca389cacaff7d5f45f6adccbe6.tar.gz |
Restoring authorship annotation for Aleksandr <ivansduck@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/pytest')
-rw-r--r-- | contrib/python/pytest/py2/_pytest/python.py | 50 | ||||
-rw-r--r-- | contrib/python/pytest/py3/_pytest/python.py | 50 |
2 files changed, 50 insertions, 50 deletions
diff --git a/contrib/python/pytest/py2/_pytest/python.py b/contrib/python/pytest/py2/_pytest/python.py index f7c368b0c4..7af7571bff 100644 --- a/contrib/python/pytest/py2/_pytest/python.py +++ b/contrib/python/pytest/py2/_pytest/python.py @@ -1204,33 +1204,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 +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', ''), safe_str(prefix)) - idx = names.setdefault(name, -1) + 1 - names[name] = idx + idx = names.setdefault(name, -1) + 1 + names[name] = idx idval = "{}-{}".format(safe_str(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, parameterset, argnames, idfn, ids, item, config): if parameterset.id is not None: return parameterset.id diff --git a/contrib/python/pytest/py3/_pytest/python.py b/contrib/python/pytest/py3/_pytest/python.py index f1a47d7d33..01011cbc15 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, |