qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tests/avocado: Replace assertRegexpMatches() for Python 3.12 compatibility
@ 2023-11-14 14:48 Philippe Mathieu-Daudé
  2023-11-14 15:32 ` Thomas Huth
  0 siblings, 1 reply; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-14 14:48 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Alex Bennée, Beraldo Leal,
	Cleber Rosa

assertRegexpMatches() has been removed in Python 3.12 and should be replaced by
assertRegex(). See: https://docs.python.org/3.12/whatsnew/3.12.html#id3

Inspired-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 docs/devel/testing.rst   | 2 +-
 tests/avocado/version.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst
index fef64accc1..0af8f32fa3 100644
--- a/docs/devel/testing.rst
+++ b/docs/devel/testing.rst
@@ -1016,7 +1016,7 @@ class.  Here's a simple usage example:
           self.vm.launch()
           res = self.vm.cmd('human-monitor-command',
                             command_line='info version')
-          self.assertRegexpMatches(res, r'^(\d+\.\d+\.\d)')
+          self.assertRegex(res, r'^(\d+\.\d+\.\d)')
 
 To execute your test, run:
 
diff --git a/tests/avocado/version.py b/tests/avocado/version.py
index 93ffdf3d97..c6139568a1 100644
--- a/tests/avocado/version.py
+++ b/tests/avocado/version.py
@@ -22,4 +22,4 @@ def test_qmp_human_info_version(self):
         self.vm.launch()
         res = self.vm.cmd('human-monitor-command',
                           command_line='info version')
-        self.assertRegexpMatches(res, r'^(\d+\.\d+\.\d)')
+        self.assertRegex(res, r'^(\d+\.\d+\.\d)')
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tests/avocado: Replace assertRegexpMatches() for Python 3.12 compatibility
  2023-11-14 14:48 [PATCH] tests/avocado: Replace assertRegexpMatches() for Python 3.12 compatibility Philippe Mathieu-Daudé
@ 2023-11-14 15:32 ` Thomas Huth
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Huth @ 2023-11-14 15:32 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Wainer dos Santos Moschetta, Alex Bennée, Beraldo Leal,
	Cleber Rosa

On 14/11/2023 15.48, Philippe Mathieu-Daudé wrote:
> assertRegexpMatches() has been removed in Python 3.12 and should be replaced by
> assertRegex(). See: https://docs.python.org/3.12/whatsnew/3.12.html#id3
> 
> Inspired-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   docs/devel/testing.rst   | 2 +-
>   tests/avocado/version.py | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst
> index fef64accc1..0af8f32fa3 100644
> --- a/docs/devel/testing.rst
> +++ b/docs/devel/testing.rst
> @@ -1016,7 +1016,7 @@ class.  Here's a simple usage example:
>             self.vm.launch()
>             res = self.vm.cmd('human-monitor-command',
>                               command_line='info version')
> -          self.assertRegexpMatches(res, r'^(\d+\.\d+\.\d)')
> +          self.assertRegex(res, r'^(\d+\.\d+\.\d)')
>   
>   To execute your test, run:
>   
> diff --git a/tests/avocado/version.py b/tests/avocado/version.py
> index 93ffdf3d97..c6139568a1 100644
> --- a/tests/avocado/version.py
> +++ b/tests/avocado/version.py
> @@ -22,4 +22,4 @@ def test_qmp_human_info_version(self):
>           self.vm.launch()
>           res = self.vm.cmd('human-monitor-command',
>                             command_line='info version')
> -        self.assertRegexpMatches(res, r'^(\d+\.\d+\.\d)')
> +        self.assertRegex(res, r'^(\d+\.\d+\.\d)')

Reviewed-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-14 15:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-14 14:48 [PATCH] tests/avocado: Replace assertRegexpMatches() for Python 3.12 compatibility Philippe Mathieu-Daudé
2023-11-14 15:32 ` Thomas Huth

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).