mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 22:10:14 +01:00
test-client: fix warnings about invalid escape sequences
In Python 3.12 a backslash-character pair that is not a valid escape
sequence generates a SyntaxWarning [1]:
src/tests/client/test-client.py:2161: SyntaxWarning: invalid escape sequence '\?'
nmc.pexp.expect("Do you want to provide them\? \(yes/no\) \[yes]")
Use raw strings to avoid that.
[1] https://docs.python.org/3/whatsnew/3.12.html
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1785
(cherry picked from commit 85bcf2d99f)
This commit is contained in:
parent
e17db98e64
commit
7713f4e90a
1 changed files with 30 additions and 30 deletions
|
|
@ -543,7 +543,7 @@ class Util:
|
|||
[
|
||||
"sed",
|
||||
"-e",
|
||||
"/^--[0-9]\+-- WARNING: unhandled .* syscall: /,/^--[0-9]\+-- it at http.*\.$/d",
|
||||
r"/^--[0-9]\+-- WARNING: unhandled .* syscall: /,/^--[0-9]\+-- it at http.*\.$/d",
|
||||
name,
|
||||
],
|
||||
stdout=subprocess.PIPE,
|
||||
|
|
@ -2184,18 +2184,18 @@ class TestNmcli(unittest.TestCase):
|
|||
nmc.pexp.expect("Interface name:")
|
||||
nmc.pexp.sendline("eth0")
|
||||
nmc.pexp.expect("There are 3 optional settings for Wired Ethernet.")
|
||||
nmc.pexp.expect("Do you want to provide them\? \(yes/no\) \[yes]")
|
||||
nmc.pexp.expect(r"Do you want to provide them\? \(yes/no\) \[yes]")
|
||||
nmc.pexp.sendline("no")
|
||||
nmc.pexp.expect("There are 2 optional settings for IPv4 protocol.")
|
||||
nmc.pexp.expect("Do you want to provide them\? \(yes/no\) \[yes]")
|
||||
nmc.pexp.expect(r"Do you want to provide them\? \(yes/no\) \[yes]")
|
||||
nmc.pexp.sendline("no")
|
||||
nmc.pexp.expect("There are 2 optional settings for IPv6 protocol.")
|
||||
nmc.pexp.expect("Do you want to provide them\? \(yes/no\) \[yes]")
|
||||
nmc.pexp.expect(r"Do you want to provide them\? \(yes/no\) \[yes]")
|
||||
nmc.pexp.sendline("no")
|
||||
nmc.pexp.expect("There are 4 optional settings for Proxy.")
|
||||
nmc.pexp.expect("Do you want to provide them\? \(yes/no\) \[yes]")
|
||||
nmc.pexp.expect(r"Do you want to provide them\? \(yes/no\) \[yes]")
|
||||
nmc.pexp.sendline("no")
|
||||
nmc.pexp.expect("Connection 'ethernet' \(.*\) successfully added.")
|
||||
nmc.pexp.expect(r"Connection 'ethernet' \(.*\) successfully added.")
|
||||
nmc.pexp.expect(pexpect.EOF)
|
||||
Util.valgrind_check_log(nmc.valgrind_log, "test_ask_mode")
|
||||
|
||||
|
|
@ -2216,34 +2216,34 @@ class TestNmcli(unittest.TestCase):
|
|||
nmc.pexp.expect("Interface name:")
|
||||
nmc.pexp.sendline("eth0")
|
||||
nmc.pexp.expect("There are 3 optional settings for Wired Ethernet.")
|
||||
nmc.pexp.expect("Do you want to provide them\? \(yes/no\) \[yes]")
|
||||
nmc.pexp.expect(r"Do you want to provide them\? \(yes/no\) \[yes]")
|
||||
nmc.pexp.sendline("no")
|
||||
nmc.pexp.expect("There are 2 optional settings for IPv4 protocol.")
|
||||
nmc.pexp.expect("Do you want to provide them\? \(yes/no\) \[yes]")
|
||||
nmc.pexp.expect(r"Do you want to provide them\? \(yes/no\) \[yes]")
|
||||
nmc.pexp.sendline("no")
|
||||
nmc.pexp.expect("There are 2 optional settings for IPv6 protocol.")
|
||||
nmc.pexp.expect("Do you want to provide them\? \(yes/no\) \[yes]")
|
||||
nmc.pexp.expect(r"Do you want to provide them\? \(yes/no\) \[yes]")
|
||||
nmc.pexp.sendline("no")
|
||||
nmc.pexp.expect("There are 4 optional settings for Proxy.")
|
||||
nmc.pexp.expect("Do you want to provide them\? \(yes/no\) \[yes]")
|
||||
nmc.pexp.expect(r"Do you want to provide them\? \(yes/no\) \[yes]")
|
||||
nmc.pexp.sendline("no")
|
||||
nmc.pexp.expect(
|
||||
"\[connection\]\r\n"
|
||||
+ "id=ethernet\r\n"
|
||||
+ "uuid=.*\r\n"
|
||||
+ "type=ethernet\r\n"
|
||||
+ "interface-name=eth0\r\n"
|
||||
+ "\r\n"
|
||||
+ "\[ethernet\]\r\n"
|
||||
+ "\r\n"
|
||||
+ "\[ipv4\]\r\n"
|
||||
+ "method=auto\r\n"
|
||||
+ "\r\n"
|
||||
+ "\[ipv6\]\r\n"
|
||||
+ "addr-gen-mode=default\r\n"
|
||||
+ "method=auto\r\n"
|
||||
+ "\r\n"
|
||||
+ "\[proxy\]\r\n"
|
||||
r"\[connection\]\r\n"
|
||||
r"id=ethernet\r\n"
|
||||
r"uuid=.*\r\n"
|
||||
r"type=ethernet\r\n"
|
||||
r"interface-name=eth0\r\n"
|
||||
r"\r\n"
|
||||
r"\[ethernet\]\r\n"
|
||||
r"\r\n"
|
||||
r"\[ipv4\]\r\n"
|
||||
r"method=auto\r\n"
|
||||
r"\r\n"
|
||||
r"\[ipv6\]\r\n"
|
||||
r"addr-gen-mode=default\r\n"
|
||||
r"method=auto\r\n"
|
||||
r"\r\n"
|
||||
r"\[proxy\]\r\n"
|
||||
)
|
||||
nmc.pexp.expect(pexpect.EOF)
|
||||
Util.valgrind_check_log(nmc.valgrind_log, "test_ask_offline")
|
||||
|
|
@ -2538,12 +2538,12 @@ class TestNmCloudSetup(unittest.TestCase):
|
|||
nmc.pexp.expect("provider azure detected")
|
||||
nmc.pexp.expect("found interfaces: CC:00:00:00:00:01, CC:00:00:00:00:02")
|
||||
nmc.pexp.expect("found azure interfaces: 2")
|
||||
nmc.pexp.expect("interface\[0]: found a matching device with hwaddr")
|
||||
nmc.pexp.expect(r"interface\[0]: found a matching device with hwaddr")
|
||||
nmc.pexp.expect(
|
||||
"interface\[0]: (received subnet address|received subnet prefix 20)"
|
||||
r"interface\[0]: (received subnet address|received subnet prefix 20)"
|
||||
)
|
||||
nmc.pexp.expect(
|
||||
"interface\[0]: (received subnet address|received subnet prefix 20)"
|
||||
r"interface\[0]: (received subnet address|received subnet prefix 20)"
|
||||
)
|
||||
nmc.pexp.expect("get-config: success")
|
||||
nmc.pexp.expect("meta data received")
|
||||
|
|
@ -2674,7 +2674,7 @@ class TestNmCloudSetup(unittest.TestCase):
|
|||
nmc.pexp.expect("provider GCP detected")
|
||||
nmc.pexp.expect("found interfaces: CC:00:00:00:00:01, CC:00:00:00:00:02")
|
||||
nmc.pexp.expect("found GCP interfaces: 2")
|
||||
nmc.pexp.expect("GCP interface\[0]: found a requested device with hwaddr")
|
||||
nmc.pexp.expect(r"GCP interface\[0]: found a requested device with hwaddr")
|
||||
nmc.pexp.expect("get-config: success")
|
||||
nmc.pexp.expect("meta data received")
|
||||
# One of the devices has no IPv4 configuration to be modified
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue