Skip to content

regex_map_yaml.test.py: address escape warnings#13163

Merged
bneradt merged 1 commit into
apache:masterfrom
bneradt:fix-remap-yaml-regex-warnings
May 14, 2026
Merged

regex_map_yaml.test.py: address escape warnings#13163
bneradt merged 1 commit into
apache:masterfrom
bneradt:fix-remap-yaml-regex-warnings

Conversation

@bneradt
Copy link
Copy Markdown
Contributor

@bneradt bneradt commented May 14, 2026

Newer Python versions warn when the regex_map_yaml test compiles a
non-raw f-string containing regex escapes. The same string also turns
\b into a backspace before writing remap.yaml, which makes the regex in
the generated config less faithful to the source.

Here's the warning we were seeing:

Running Test regex_map_yaml:/home/jenkins/workspace/GitHub-sec-master/autest-child/src/tests/gold_tests/remap_yaml/regex_map_yaml.test.py:60: SyntaxWarning: invalid escape sequence '\.'
  tr.Processes.Default.ReturnCode = 0
/home/jenkins/workspace/GitHub-sec-master/autest-child/src/tests/gold_tests/remap_yaml/regex_map_yaml.test.py:59: SyntaxWarning: invalid escape sequence '\.'
  tr.MakeCurlCommand('-H"Host: zero.one.two.three.com" http://127.0.0.1:{0}/ --verbose'.format(ts.Variables.port), ts=ts)
. Passed

This makes the YAML config block in the test a raw f-string so regex
backslashes remain literal while the port interpolation still works.

Newer Python versions warn when the regex_map_yaml test compiles a
non-raw f-string containing regex escapes. The same string also turns
\b into a backspace before writing remap.yaml, which makes the regex in
the generated config less faithful to the source.

This makes the YAML block a raw f-string so regex backslashes remain
literal while the port interpolation still works.
@bneradt bneradt added this to the 11.0.0 milestone May 14, 2026
@bneradt bneradt self-assigned this May 14, 2026
@bneradt bneradt added Tests AuTest YAML Remap easy_review No new logic, easy to review. labels May 14, 2026
@bneradt bneradt changed the title Quiet regex_map_yaml escape warnings regex_map_yaml.test.py: address escape warnings May 14, 2026
@bneradt bneradt requested a review from serrislew May 14, 2026 16:12
@bneradt bneradt merged commit 04ee323 into apache:master May 14, 2026
15 checks passed
@bneradt bneradt deleted the fix-remap-yaml-regex-warnings branch May 14, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants