diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /contrib/python/pytest/py2/patches/03-limit-id.patch | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'contrib/python/pytest/py2/patches/03-limit-id.patch')
-rw-r--r-- | contrib/python/pytest/py2/patches/03-limit-id.patch | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/contrib/python/pytest/py2/patches/03-limit-id.patch b/contrib/python/pytest/py2/patches/03-limit-id.patch new file mode 100644 index 0000000000..5389c9290e --- /dev/null +++ b/contrib/python/pytest/py2/patches/03-limit-id.patch @@ -0,0 +1,36 @@ +--- contrib/python/pytest/py2/_pytest/python.py (index) ++++ contrib/python/pytest/py2/_pytest/python.py (working tree) +@@ -1204,6 +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 ++ name = "{}-{}".format(kw.get('item', ''), prefix) ++ 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) + def _idvalset(idx, parameterset, argnames, idfn, ids, item, config): + if parameterset.id is not None: + return parameterset.id |