[Enhancement] Replace assert_regexp_matches with assert_regex for python 3.12 in test/lib (#63456)
## Why I'm doing:
nose.tools maps assert_regexp_matches to unittest `AssertRegexpMatches`.
`AssertRegexpMatches` got renamed to `AssertRegex` and is deprecated since python 3.2. The alias got removed in 3.12 ([changelog](49e83e31bd/Doc/whatsnew/3.12.rst (unittest-1))).
When running with `python >= 3.12` this will result in `AttributeError: module 'nose.tools' has no attribute 'assert_regexp_matches'`.
## What I'm doing:
Replacing occurences of assert_regexp_matches with assert_regex.
Signed-off-by: m.bogusz <m.bogusz@celonis.com>
This commit is contained in:
parent
746392b8d2
commit
4f33574e11
|
|
@ -515,7 +515,7 @@ class ChooseCase(object):
|
|||
|
||||
_t_info_line = f_lines[line_id].rstrip()
|
||||
_t_line = _t_info_line.lstrip()
|
||||
tools.assert_regexp_matches(_t_line.lstrip(), t_info_regex, f"Missing thread info : {_t_line}")
|
||||
tools.assert_regex(_t_line.lstrip(), t_info_regex, f"Missing thread info : {_t_line}")
|
||||
|
||||
# get thread name & thread count
|
||||
_t_name, _, _t_count = re.findall(r"-- ([0-9a-zA-Z_\- ]+)(\(([0-9]+)\))?:", _t_line)[0]
|
||||
|
|
|
|||
|
|
@ -1442,7 +1442,7 @@ class StarrocksSQLApiLib(object):
|
|||
else:
|
||||
if exp.startswith(REGEX_FLAG):
|
||||
log.info("[check regex]: %s" % exp[len(REGEX_FLAG) :])
|
||||
tools.assert_regexp_matches(
|
||||
tools.assert_regex(
|
||||
r"%s" % str(act),
|
||||
exp[len(REGEX_FLAG) :],
|
||||
"sql result not match regex:\n- [SQL]: %s\n- [exp]: %s\n- [act]: %s\n---"
|
||||
|
|
@ -3155,7 +3155,7 @@ out.append("${{dictMgr.NO_DICT_STRING_COLUMNS.contains(cid)}}")
|
|||
act.append(processed_row)
|
||||
|
||||
log.info("[check regex]: %s" % exp[len(REGEX_FLAG) :])
|
||||
tools.assert_regexp_matches(
|
||||
tools.assert_regex(
|
||||
r"%s" % str(act),
|
||||
exp[len(REGEX_FLAG) :],
|
||||
"sql result not match regex:\n- [SQL]: %s\n- [exp]: %s\n- [act]: %s\n---"
|
||||
|
|
|
|||
Loading…
Reference in New Issue