[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/10] tests/avocado: Replace assertRegexpMatches() for Python 3.1
|
From: |
Thomas Huth |
|
Subject: |
[PULL 02/10] tests/avocado: Replace assertRegexpMatches() for Python 3.12 compatibility |
|
Date: |
Thu, 16 Nov 2023 19:05:26 +0100 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
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 | 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 87ed30af22..22218dbedb 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
- [PULL 00/10] Avocado test fixes, Thomas Huth, 2023/11/16
- [PULL 01/10] tests/avocado: Replace assertEquals() for Python 3.12 compatibility, Thomas Huth, 2023/11/16
- [PULL 05/10] tests/avocado/multiprocess: Add asset hashes to silence warnings, Thomas Huth, 2023/11/16
- [PULL 03/10] tests/avocado/virtio-gpu: Fix test_vhost_user_vga_virgl for edid support, Thomas Huth, 2023/11/16
- [PULL 02/10] tests/avocado: Replace assertRegexpMatches() for Python 3.12 compatibility,
Thomas Huth <=
- [PULL 07/10] tests/avocado/replay_kernel: Mark the test_x86_64_pc as flaky, Thomas Huth, 2023/11/16
- [PULL 06/10] tests/avocado: Make fetch_asset() unconditionally require a crypto hash, Thomas Huth, 2023/11/16
- [PULL 09/10] tests/avocado: reverse_debugging drain console to prevent hang, Thomas Huth, 2023/11/16
- [PULL 04/10] tests/avocado/intel_iommu: Add asset hashes to avoid warnings, Thomas Huth, 2023/11/16
- [PULL 08/10] tests/avocado/mem-addr-space-check: Replace assertEquals() for Python 3.12, Thomas Huth, 2023/11/16
- [PULL 10/10] tests/avocado: Enable reverse_debugging.py tests in gitlab CI, Thomas Huth, 2023/11/16
- Re: [PULL 00/10] Avocado test fixes, Stefan Hajnoczi, 2023/11/20