From: Philippe Mathieu-Daudé Date: Tue, 14 Nov 2023 14:48:31 +0000 (+0100) Subject: tests/avocado: Replace assertRegexpMatches() for Python 3.12 compatibility X-Git-Tag: v8.2.0-rc1~13^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f0a663b4ced2bf315936c774c2b6ff398fce8905;p=thirdparty%2Fqemu.git tests/avocado: Replace assertRegexpMatches() for Python 3.12 compatibility 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 Signed-off-by: Philippe Mathieu-Daudé Message-ID: <20231114144832.71612-1-philmd@linaro.org> Reviewed-by: Thomas Huth Signed-off-by: Thomas Huth --- diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 87ed30af225..22218dbedbb 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 93ffdf3d977..c6139568a16 100644 --- a/tests/avocado/version.py +++ b/tests/avocado/version.py @@ -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)')