Add warning for an empty group in the message string
This commit is contained in:
parent
635fbe2bff
commit
de96d738eb
|
@ -1924,6 +1924,13 @@ def parse_warning_filter(
|
|||
raise UsageError(error_template.format(error=exception_text)) from None
|
||||
if message and escape:
|
||||
message = re.escape(message)
|
||||
if "()" in message:
|
||||
warning = dedent(
|
||||
"""
|
||||
An empty group '()' will not match a string that contains literal parenthesis
|
||||
"""
|
||||
)
|
||||
warnings.warn(PytestConfigWarning(warning))
|
||||
if module and escape:
|
||||
module = re.escape(module) + r"\Z"
|
||||
if lineno_:
|
||||
|
|
Loading…
Reference in New Issue