git: 124ecd59ba81 - stable/14 - ping tests: Silence deprecation warnings

From: Jose Luis Duran <jlduran_at_FreeBSD.org>
Date: Thu, 14 Nov 2024 03:25:07 UTC
The branch stable/14 has been updated by jlduran:

URL: https://cgit.FreeBSD.org/src/commit/?id=124ecd59ba8160f9adbaca833e83a96b2d57370d

commit 124ecd59ba8160f9adbaca833e83a96b2d57370d
Author:     Jose Luis Duran <jlduran@FreeBSD.org>
AuthorDate: 2024-11-05 03:04:53 +0000
Commit:     Jose Luis Duran <jlduran@FreeBSD.org>
CommitDate: 2024-11-14 03:23:16 +0000

    ping tests: Silence deprecation warnings
    
    Declare some regex patterns as a raw string by prepending `r`.
    
    Reviewed by:    markj
    Approved by:    emaste (mentor)
    Differential Revision:  https://reviews.freebsd.org/D42174
    
    (cherry picked from commit 8b13cb9d654c985534d24a09ec5dab02cc4dea6e)
---
 sbin/ping/tests/test_ping.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sbin/ping/tests/test_ping.py b/sbin/ping/tests/test_ping.py
index cf2e46a146c8..93b42d7d53bd 100644
--- a/sbin/ping/tests/test_ping.py
+++ b/sbin/ping/tests/test_ping.py
@@ -270,15 +270,15 @@ def pinger(
 def redact(output):
     """Redact some elements of ping's output"""
     pattern_replacements = [
-        ("localhost \([0-9]{1,3}(\.[0-9]{1,3}){3}\)", "localhost"),
-        ("from [0-9]{1,3}(\.[0-9]{1,3}){3}", "from"),
+        (r"localhost \([0-9]{1,3}(\.[0-9]{1,3}){3}\)", "localhost"),
+        (r"from [0-9]{1,3}(\.[0-9]{1,3}){3}", "from"),
         ("hlim=[0-9]*", "hlim="),
         ("ttl=[0-9]*", "ttl="),
         ("time=[0-9.-]*", "time="),
         ("cp: .*", "cp: xx xx xx xx xx xx xx xx"),
         ("dp: .*", "dp: xx xx xx xx xx xx xx xx"),
-        ("\(-[0-9\.]+[0-9]+ ms\)", "(- ms)"),
-        ("[0-9\.]+/[0-9.]+", "/"),
+        (r"\(-[0-9\.]+[0-9]+ ms\)", "(- ms)"),
+        (r"[0-9\.]+/[0-9.]+", "/"),
     ]
     for pattern, repl in pattern_replacements:
         output = re.sub(pattern, repl, output)