* [PATCH] tests/avocado/machine_s390_ccw_virtio.py: Fix SyntaxWarnings from python 3.12
@ 2023-11-13 14:07 Thomas Huth
2023-11-13 14:47 ` Philippe Mathieu-Daudé
2023-11-13 16:12 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 4+ messages in thread
From: Thomas Huth @ 2023-11-13 14:07 UTC (permalink / raw)
To: qemu-s390x, Halil Pasic, Christian Borntraeger
Cc: qemu-devel, Eric Farman, Cleber Rosa, Philippe Mathieu-Daudé,
Wainer dos Santos Moschetta, Beraldo Leal, John Snow
Python 3.12 now warns about backslashes in strings that aren't used
for escaping a special character from Python. Silence the warning
by using raw strings here instead.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/avocado/machine_s390_ccw_virtio.py | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/tests/avocado/machine_s390_ccw_virtio.py b/tests/avocado/machine_s390_ccw_virtio.py
index e1f493bc44..ffd914ded9 100644
--- a/tests/avocado/machine_s390_ccw_virtio.py
+++ b/tests/avocado/machine_s390_ccw_virtio.py
@@ -36,8 +36,8 @@ def wait_for_crw_reports(self):
dmesg_clear_count = 1
def clear_guest_dmesg(self):
exec_command_and_wait_for_pattern(self, 'dmesg -c > /dev/null; '
- 'echo dm_clear\ ' + str(self.dmesg_clear_count),
- 'dm_clear ' + str(self.dmesg_clear_count))
+ r'echo dm_clear\ ' + str(self.dmesg_clear_count),
+ r'dm_clear ' + str(self.dmesg_clear_count))
self.dmesg_clear_count += 1
def test_s390x_devices(self):
@@ -121,15 +121,15 @@ def test_s390x_devices(self):
'cat /sys/bus/ccw/devices/0.1.1111/cutype',
'3832/01')
exec_command_and_wait_for_pattern(self,
- 'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_vendor',
- '0x1af4')
+ r'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_vendor',
+ r'0x1af4')
exec_command_and_wait_for_pattern(self,
- 'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_device',
- '0x0001')
+ r'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_device',
+ r'0x0001')
# check fid propagation
exec_command_and_wait_for_pattern(self,
- 'cat /sys/bus/pci/devices/000a\:00\:00.0/function_id',
- '0x0000000c')
+ r'cat /sys/bus/pci/devices/000a\:00\:00.0/function_id',
+ r'0x0000000c')
# add another device
self.clear_guest_dmesg()
self.vm.cmd('device_add', driver='virtio-net-ccw',
@@ -235,7 +235,7 @@ def test_s390x_fedora(self):
'while ! (dmesg | grep gpudrmfb) ; do sleep 1 ; done',
'virtio_gpudrmfb frame buffer device')
exec_command_and_wait_for_pattern(self,
- 'echo -e "\e[?25l" > /dev/tty0', ':/#')
+ r'echo -e "\e[?25l" > /dev/tty0', ':/#')
exec_command_and_wait_for_pattern(self, 'for ((i=0;i<250;i++)); do '
'echo " The qu ick fo x j ump s o ver a laz y d og" >> fox.txt;'
'done',
--
2.41.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] tests/avocado/machine_s390_ccw_virtio.py: Fix SyntaxWarnings from python 3.12
2023-11-13 14:07 [PATCH] tests/avocado/machine_s390_ccw_virtio.py: Fix SyntaxWarnings from python 3.12 Thomas Huth
@ 2023-11-13 14:47 ` Philippe Mathieu-Daudé
2023-11-13 15:48 ` Thomas Huth
2023-11-13 16:12 ` Philippe Mathieu-Daudé
1 sibling, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-13 14:47 UTC (permalink / raw)
To: Thomas Huth, qemu-s390x, Halil Pasic, Christian Borntraeger
Cc: qemu-devel, Eric Farman, Cleber Rosa, Wainer dos Santos Moschetta,
Beraldo Leal, John Snow
On 13/11/23 15:07, Thomas Huth wrote:
> Python 3.12 now warns about backslashes in strings that aren't used
> for escaping a special character from Python. Silence the warning
> by using raw strings here instead.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> tests/avocado/machine_s390_ccw_virtio.py | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/tests/avocado/machine_s390_ccw_virtio.py b/tests/avocado/machine_s390_ccw_virtio.py
> index e1f493bc44..ffd914ded9 100644
> --- a/tests/avocado/machine_s390_ccw_virtio.py
> +++ b/tests/avocado/machine_s390_ccw_virtio.py
> @@ -36,8 +36,8 @@ def wait_for_crw_reports(self):
> dmesg_clear_count = 1
> def clear_guest_dmesg(self):
> exec_command_and_wait_for_pattern(self, 'dmesg -c > /dev/null; '
> - 'echo dm_clear\ ' + str(self.dmesg_clear_count),
> - 'dm_clear ' + str(self.dmesg_clear_count))
> + r'echo dm_clear\ ' + str(self.dmesg_clear_count),
> + r'dm_clear ' + str(self.dmesg_clear_count))
> self.dmesg_clear_count += 1
>
> def test_s390x_devices(self):
> @@ -121,15 +121,15 @@ def test_s390x_devices(self):
> 'cat /sys/bus/ccw/devices/0.1.1111/cutype',
> '3832/01')
> exec_command_and_wait_for_pattern(self,
> - 'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_vendor',
> - '0x1af4')
> + r'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_vendor',
> + r'0x1af4')
Do we really need to escape the hex number?
> exec_command_and_wait_for_pattern(self,
> - 'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_device',
> - '0x0001')
> + r'cat /sys/bus/pci/devices/0005\:00\:00.0/subsystem_device',
> + r'0x0001')
Ditto,
> # check fid propagation
> exec_command_and_wait_for_pattern(self,
> - 'cat /sys/bus/pci/devices/000a\:00\:00.0/function_id',
> - '0x0000000c')
> + r'cat /sys/bus/pci/devices/000a\:00\:00.0/function_id',
> + r'0x0000000c')
Ditto.
Otherwise,
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> # add another device
> self.clear_guest_dmesg()
> self.vm.cmd('device_add', driver='virtio-net-ccw',
> @@ -235,7 +235,7 @@ def test_s390x_fedora(self):
> 'while ! (dmesg | grep gpudrmfb) ; do sleep 1 ; done',
> 'virtio_gpudrmfb frame buffer device')
> exec_command_and_wait_for_pattern(self,
> - 'echo -e "\e[?25l" > /dev/tty0', ':/#')
> + r'echo -e "\e[?25l" > /dev/tty0', ':/#')
> exec_command_and_wait_for_pattern(self, 'for ((i=0;i<250;i++)); do '
> 'echo " The qu ick fo x j ump s o ver a laz y d og" >> fox.txt;'
> 'done',
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tests/avocado/machine_s390_ccw_virtio.py: Fix SyntaxWarnings from python 3.12
2023-11-13 14:47 ` Philippe Mathieu-Daudé
@ 2023-11-13 15:48 ` Thomas Huth
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2023-11-13 15:48 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-s390x, Halil Pasic,
Christian Borntraeger
Cc: qemu-devel, Eric Farman, Cleber Rosa, Wainer dos Santos Moschetta,
Beraldo Leal, John Snow
On 13/11/2023 15.47, Philippe Mathieu-Daudé wrote:
> On 13/11/23 15:07, Thomas Huth wrote:
>> Python 3.12 now warns about backslashes in strings that aren't used
>> for escaping a special character from Python. Silence the warning
>> by using raw strings here instead.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>> tests/avocado/machine_s390_ccw_virtio.py | 18 +++++++++---------
>> 1 file changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/tests/avocado/machine_s390_ccw_virtio.py
>> b/tests/avocado/machine_s390_ccw_virtio.py
>> index e1f493bc44..ffd914ded9 100644
>> --- a/tests/avocado/machine_s390_ccw_virtio.py
>> +++ b/tests/avocado/machine_s390_ccw_virtio.py
>> @@ -36,8 +36,8 @@ def wait_for_crw_reports(self):
>> dmesg_clear_count = 1
>> def clear_guest_dmesg(self):
>> exec_command_and_wait_for_pattern(self, 'dmesg -c > /dev/null; '
>> - 'echo dm_clear\ ' + str(self.dmesg_clear_count),
>> - 'dm_clear ' + str(self.dmesg_clear_count))
>> + r'echo dm_clear\ ' + str(self.dmesg_clear_count),
>> + r'dm_clear ' + str(self.dmesg_clear_count))
>> self.dmesg_clear_count += 1
>> def test_s390x_devices(self):
>> @@ -121,15 +121,15 @@ def test_s390x_devices(self):
>> 'cat
>> /sys/bus/ccw/devices/0.1.1111/cutype',
>> '3832/01')
>> exec_command_and_wait_for_pattern(self,
>> - 'cat
>> /sys/bus/pci/devices/0005\:00\:00.0/subsystem_vendor',
>> - '0x1af4')
>> + r'cat
>> /sys/bus/pci/devices/0005\:00\:00.0/subsystem_vendor',
>> + r'0x1af4')
>
> Do we really need to escape the hex number?
No, technically not, but it look kind of ugly to me if the strings that are
indented on the same level start with a different prefix, so I'd prefer to
keep them.
>
> Otherwise,
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Thanks!
Thomas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tests/avocado/machine_s390_ccw_virtio.py: Fix SyntaxWarnings from python 3.12
2023-11-13 14:07 [PATCH] tests/avocado/machine_s390_ccw_virtio.py: Fix SyntaxWarnings from python 3.12 Thomas Huth
2023-11-13 14:47 ` Philippe Mathieu-Daudé
@ 2023-11-13 16:12 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-13 16:12 UTC (permalink / raw)
To: Thomas Huth, qemu-s390x, Halil Pasic, Christian Borntraeger
Cc: qemu-devel, Eric Farman, Cleber Rosa, Wainer dos Santos Moschetta,
Beraldo Leal, John Snow
On 13/11/23 15:07, Thomas Huth wrote:
> Python 3.12 now warns about backslashes in strings that aren't used
> for escaping a special character from Python. Silence the warning
> by using raw strings here instead.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> tests/avocado/machine_s390_ccw_virtio.py | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
Thanks, patch queued.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-11-13 16:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-13 14:07 [PATCH] tests/avocado/machine_s390_ccw_virtio.py: Fix SyntaxWarnings from python 3.12 Thomas Huth
2023-11-13 14:47 ` Philippe Mathieu-Daudé
2023-11-13 15:48 ` Thomas Huth
2023-11-13 16:12 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).