From: Thierry Parmentelat Date: Tue, 26 Nov 2024 15:49:32 +0000 (+0100) Subject: re.compile arguments made raw-strings for py-3.13 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;p=tests.git re.compile arguments made raw-strings for py-3.13 --- diff --git a/system/Substrate.py b/system/Substrate.py index 2ab6c89..d531cfb 100644 --- a/system/Substrate.py +++ b/system/Substrate.py @@ -459,8 +459,8 @@ class BuildBox (Box): else: self.soft_reboot (options) -build_matcher=re.compile("\s*(?P[0-9]+).*-[bo]\s+(?P[^\s]+)(\s|\Z)") -build_matcher_initvm=re.compile("\s*(?P[0-9]+).*initvm.*\s+(?P[^\s]+)\s*\Z") +build_matcher=re.compile(r"\s*(?P[0-9]+).*-[bo]\s+(?P[^\s]+)(\s|\Z)") +build_matcher_initvm=re.compile(r"\s*(?P[0-9]+).*initvm.*\s+(?P[^\s]+)\s*\Z") class BuildLxcBox (BuildBox): def soft_reboot (self, options): @@ -743,7 +743,7 @@ class QemuBox (Box): self.run_ssh(['pkill','qemu'], "Killing qemu instances", dry_run=options.dry_run) - matcher=re.compile("\s*(?P[0-9]+).*-cdrom\s+(?P[^\s]+)\.iso") + matcher=re.compile(r"\s*(?P[0-9]+).*-cdrom\s+(?P[^\s]+)\.iso") def sense(self, options): print('qn', end=' ') @@ -927,9 +927,9 @@ class TestBox(Box): self.test_instances.append(i) i.set_broken(plcindex, step) - matcher_proc=re.compile (".*/proc/(?P[0-9]+)/cwd.*/root/(?P[^/]+)$") - matcher_grep=re.compile ("/root/(?P[^/]+)/logs/trace.*:TRACE:\s*(?P[0-9]+).*step=(?P\S+).*") - matcher_grep_missing=re.compile ("grep: /root/(?P[^/]+)/logs/trace: No such file or directory") + matcher_proc=re.compile(r".*/proc/(?P[0-9]+)/cwd.*/root/(?P[^/]+)$") + matcher_grep=re.compile(r"/root/(?P[^/]+)/logs/trace.*:TRACE:\s*(?P[0-9]+).*step=(?P\S+).*") + matcher_grep_missing=re.compile(r"grep: /root/(?P[^/]+)/logs/trace: No such file or directory") def sense(self, options): print('tm', end=' ') diff --git a/system/TestPlc.py b/system/TestPlc.py index 9cf5a2f..e7b41f6 100644 --- a/system/TestPlc.py +++ b/system/TestPlc.py @@ -1619,7 +1619,7 @@ class TestPlc: return True utils.header("********** Regular yum failed - special workaround in place, 2nd chance") code, cached_rpm_path = \ - utils.output_of(self.actual_command_in_guest('find /var/cache/yum -name sfa-client\*.rpm')) + utils.output_of(self.actual_command_in_guest(r'find /var/cache/yum -name sfa-client\*.rpm')) utils.header("rpm_path=<<{}>>".format(rpm_path)) # just for checking self.run_in_guest("rpm -i {}".format(cached_rpm_path)) diff --git a/system/template-qemu/iptables.py b/system/template-qemu/iptables.py index d694878..ded7e17 100755 --- a/system/template-qemu/iptables.py +++ b/system/template-qemu/iptables.py @@ -9,9 +9,9 @@ def main(): ip = sys.argv[3] found = False - lo_matcher = re.compile("\A(?P.+)\s+-i\s+lo\s+-j\s+ACCEPT") + lo_matcher = re.compile(r"\A(?P.+)\s+-i\s+lo\s+-j\s+ACCEPT") # what comes out of iptables-save has short-options syntax - ip_matcher = re.compile(".*-(s|d) %s" % ip) + ip_matcher = re.compile(r".*-(s|d) %s" % ip) for line in fin.readlines(): attempt = lo_matcher.match(line) if attempt: