OSDN Git Service

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)
committerThomas Huth <thuth@redhat.com>
Thu, 16 Nov 2023 06:13:41 +0000 (07:13 +0100)
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>
docs/devel/testing.rst
tests/avocado/version.py

index 87ed30a..22218db 100644 (file)
@@ -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:
 
index 93ffdf3..c613956 100644 (file)
@@ -22,4 +22,4 @@ class Version(QemuSystemTest):
         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)')