Skip to content

Commit

Permalink
tests/avocado: Replace assertRegexpMatches() for Python 3.12 compatib…
Browse files Browse the repository at this point in the history
…ility

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>
  • Loading branch information
philmd authored and huth committed Nov 16, 2023
1 parent 861f724 commit f0a663b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/devel/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion tests/avocado/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)')

0 comments on commit f0a663b

Please sign in to comment.