]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
tests/avocado: Replace assertRegexpMatches() for Python 3.12 compatibility
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 14 Nov 2023 14:48:31 +0000 (15:48 +0100)
committerMichael Tokarev <mjt@tls.msk.ru>
Wed, 29 Nov 2023 13:20:11 +0000 (16:20 +0300)
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>
Message-ID: <20231114144832.71612-1-philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit f0a663b4ced2bf315936c774c2b6ff398fce8905)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(Mjt: adjust context for before v8.1.0-1582-g684750ab4f
 "python/qemu: rename command() to cmd()")

docs/devel/testing.rst
tests/avocado/version.py

index 8cad156aa07819d9e1a2488187ff68bf31c79398..98c26ecf1883cf6757e3291ea1045ae60efb9c55 100644 (file)
@@ -990,7 +990,7 @@ class.  Here's a simple usage example:
           self.vm.launch()
           res = self.vm.command('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:
 
index ded7f039c1ba927ed385f16fbb665933ca0423b0..5f88ff300bc4ea599fe100c8850a55bdd3094e06 100644 (file)
@@ -21,4 +21,4 @@ class Version(QemuSystemTest):
         self.vm.launch()
         res = self.vm.command('human-monitor-command',
                               command_line='info version')
-        self.assertRegexpMatches(res, r'^(\d+\.\d+\.\d)')
+        self.assertRegex(res, r'^(\d+\.\d+\.\d)')