[PATCH] tests/avocado/mem-addr-space-check: Replace assertEquals() for Python 3.12

Thomas Huth posted 1 patch 1 year ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20231116061956.14676-1-thuth@redhat.com
Maintainers: Cleber Rosa <crosa@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Wainer dos Santos Moschetta <wainersm@redhat.com>, Beraldo Leal <bleal@redhat.com>
tests/avocado/mem-addr-space-check.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
[PATCH] tests/avocado/mem-addr-space-check: Replace assertEquals() for Python 3.12
Posted by Thomas Huth 1 year ago
assertEquals() has been removed in Python 3.12 and should be replaced by
assertEqual(). See: https://docs.python.org/3.12/whatsnew/3.12.html#id3

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 Note: The test has just been merged, that's why I missed this file in
 my earlier patch that replaces the assertEquals()

 tests/avocado/mem-addr-space-check.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/avocado/mem-addr-space-check.py b/tests/avocado/mem-addr-space-check.py
index be949222a4..363c3f12a6 100644
--- a/tests/avocado/mem-addr-space-check.py
+++ b/tests/avocado/mem-addr-space-check.py
@@ -49,7 +49,7 @@ def test_phybits_low_pse36(self):
         self.vm.set_qmp_monitor(enabled=False)
         self.vm.launch()
         self.vm.wait()
-        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
+        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
         self.assertRegex(self.vm.get_log(), r'phys-bits too low')
 
     def test_phybits_low_pae(self):
@@ -69,7 +69,7 @@ def test_phybits_low_pae(self):
         self.vm.set_qmp_monitor(enabled=False)
         self.vm.launch()
         self.vm.wait()
-        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
+        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
         self.assertRegex(self.vm.get_log(), r'phys-bits too low')
 
     def test_phybits_ok_pentium_pse36(self):
@@ -149,7 +149,7 @@ def test_phybits_low_nonpse36(self):
         self.vm.set_qmp_monitor(enabled=False)
         self.vm.launch()
         self.vm.wait()
-        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
+        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
         self.assertRegex(self.vm.get_log(), r'phys-bits too low')
 
     # now lets test some 64-bit CPU cases.
@@ -179,7 +179,7 @@ def test_phybits_low_tcg_q35_70_amd(self):
         self.vm.set_qmp_monitor(enabled=False)
         self.vm.launch()
         self.vm.wait()
-        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
+        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
         self.assertRegex(self.vm.get_log(), r'phys-bits too low')
 
     def test_phybits_low_tcg_q35_71_amd(self):
@@ -202,7 +202,7 @@ def test_phybits_low_tcg_q35_71_amd(self):
         self.vm.set_qmp_monitor(enabled=False)
         self.vm.launch()
         self.vm.wait()
-        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
+        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
         self.assertRegex(self.vm.get_log(), r'phys-bits too low')
 
     def test_phybits_ok_tcg_q35_70_amd(self):
@@ -288,7 +288,7 @@ def test_phybits_low_tcg_q35_71_amd_41bits(self):
         self.vm.set_qmp_monitor(enabled=False)
         self.vm.launch()
         self.vm.wait()
-        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
+        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
         self.assertRegex(self.vm.get_log(), r'phys-bits too low')
 
     def test_phybits_ok_tcg_q35_71_amd_41bits(self):
@@ -332,7 +332,7 @@ def test_phybits_low_tcg_q35_intel_cxl(self):
         self.vm.set_qmp_monitor(enabled=False)
         self.vm.launch()
         self.vm.wait()
-        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
+        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
         self.assertRegex(self.vm.get_log(), r'phys-bits too low')
 
     def test_phybits_ok_tcg_q35_intel_cxl(self):
-- 
2.41.0
Re: [PATCH] tests/avocado/mem-addr-space-check: Replace assertEquals() for Python 3.12
Posted by Philippe Mathieu-Daudé 10 months, 1 week ago
On 16/11/23 07:19, Thomas Huth wrote:
> assertEquals() has been removed in Python 3.12 and should be replaced by
> assertEqual(). See: https://docs.python.org/3.12/whatsnew/3.12.html#id3
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   Note: The test has just been merged, that's why I missed this file in
>   my earlier patch that replaces the assertEquals()
> 
>   tests/avocado/mem-addr-space-check.py | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)

Merged as commit 572960cb23.
Re: [PATCH] tests/avocado/mem-addr-space-check: Replace assertEquals() for Python 3.12
Posted by Ani Sinha 1 year ago

> On 16-Nov-2023, at 11:49 AM, Thomas Huth <thuth@redhat.com> wrote:
> 
> assertEquals() has been removed in Python 3.12 and should be replaced by
> assertEqual(). See: https://docs.python.org/3.12/whatsnew/3.12.html#id3
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Acked-by: Ani Sinha <anisinha@redhat.com <mailto:anisinha@redhat.com>>

> ---
> Note: The test has just been merged, that's why I missed this file in
> my earlier patch that replaces the assertEquals()
> 
> tests/avocado/mem-addr-space-check.py | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/avocado/mem-addr-space-check.py b/tests/avocado/mem-addr-space-check.py
> index be949222a4..363c3f12a6 100644
> --- a/tests/avocado/mem-addr-space-check.py
> +++ b/tests/avocado/mem-addr-space-check.py
> @@ -49,7 +49,7 @@ def test_phybits_low_pse36(self):
>         self.vm.set_qmp_monitor(enabled=False)
>         self.vm.launch()
>         self.vm.wait()
> -        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
> +        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>         self.assertRegex(self.vm.get_log(), r'phys-bits too low')
> 
>     def test_phybits_low_pae(self):
> @@ -69,7 +69,7 @@ def test_phybits_low_pae(self):
>         self.vm.set_qmp_monitor(enabled=False)
>         self.vm.launch()
>         self.vm.wait()
> -        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
> +        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>         self.assertRegex(self.vm.get_log(), r'phys-bits too low')
> 
>     def test_phybits_ok_pentium_pse36(self):
> @@ -149,7 +149,7 @@ def test_phybits_low_nonpse36(self):
>         self.vm.set_qmp_monitor(enabled=False)
>         self.vm.launch()
>         self.vm.wait()
> -        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
> +        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>         self.assertRegex(self.vm.get_log(), r'phys-bits too low')
> 
>     # now lets test some 64-bit CPU cases.
> @@ -179,7 +179,7 @@ def test_phybits_low_tcg_q35_70_amd(self):
>         self.vm.set_qmp_monitor(enabled=False)
>         self.vm.launch()
>         self.vm.wait()
> -        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
> +        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>         self.assertRegex(self.vm.get_log(), r'phys-bits too low')
> 
>     def test_phybits_low_tcg_q35_71_amd(self):
> @@ -202,7 +202,7 @@ def test_phybits_low_tcg_q35_71_amd(self):
>         self.vm.set_qmp_monitor(enabled=False)
>         self.vm.launch()
>         self.vm.wait()
> -        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
> +        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>         self.assertRegex(self.vm.get_log(), r'phys-bits too low')
> 
>     def test_phybits_ok_tcg_q35_70_amd(self):
> @@ -288,7 +288,7 @@ def test_phybits_low_tcg_q35_71_amd_41bits(self):
>         self.vm.set_qmp_monitor(enabled=False)
>         self.vm.launch()
>         self.vm.wait()
> -        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
> +        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>         self.assertRegex(self.vm.get_log(), r'phys-bits too low')
> 
>     def test_phybits_ok_tcg_q35_71_amd_41bits(self):
> @@ -332,7 +332,7 @@ def test_phybits_low_tcg_q35_intel_cxl(self):
>         self.vm.set_qmp_monitor(enabled=False)
>         self.vm.launch()
>         self.vm.wait()
> -        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
> +        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>         self.assertRegex(self.vm.get_log(), r'phys-bits too low')
> 
>     def test_phybits_ok_tcg_q35_intel_cxl(self):
> -- 
> 2.41.0
> 
Re: [PATCH] tests/avocado/mem-addr-space-check: Replace assertEquals() for Python 3.12
Posted by Ani Sinha 1 year ago

> On 16-Nov-2023, at 12:56 PM, Ani Sinha <anisinha@redhat.com> wrote:
> 
> 
> 
>> On 16-Nov-2023, at 11:49 AM, Thomas Huth <thuth@redhat.com> wrote:
>> 
>> assertEquals() has been removed in Python 3.12 and should be replaced by
>> assertEqual(). See: https://docs.python.org/3.12/whatsnew/3.12.html#id3
>> 
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
> 
> Acked-by: Ani Sinha <anisinha@redhat.com <mailto:anisinha@redhat.com>>

Acked-by: Ani Sinha <anisinha@redhat.com>

> 
>> ---
>> Note: The test has just been merged, that's why I missed this file in
>> my earlier patch that replaces the assertEquals()
>> 
>> tests/avocado/mem-addr-space-check.py | 14 +++++++-------
>> 1 file changed, 7 insertions(+), 7 deletions(-)
>> 
>> diff --git a/tests/avocado/mem-addr-space-check.py b/tests/avocado/mem-addr-space-check.py
>> index be949222a4..363c3f12a6 100644
>> --- a/tests/avocado/mem-addr-space-check.py
>> +++ b/tests/avocado/mem-addr-space-check.py
>> @@ -49,7 +49,7 @@ def test_phybits_low_pse36(self):
>>        self.vm.set_qmp_monitor(enabled=False)
>>        self.vm.launch()
>>        self.vm.wait()
>> -        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>> +        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>>        self.assertRegex(self.vm.get_log(), r'phys-bits too low')
>> 
>>    def test_phybits_low_pae(self):
>> @@ -69,7 +69,7 @@ def test_phybits_low_pae(self):
>>        self.vm.set_qmp_monitor(enabled=False)
>>        self.vm.launch()
>>        self.vm.wait()
>> -        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>> +        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>>        self.assertRegex(self.vm.get_log(), r'phys-bits too low')
>> 
>>    def test_phybits_ok_pentium_pse36(self):
>> @@ -149,7 +149,7 @@ def test_phybits_low_nonpse36(self):
>>        self.vm.set_qmp_monitor(enabled=False)
>>        self.vm.launch()
>>        self.vm.wait()
>> -        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>> +        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>>        self.assertRegex(self.vm.get_log(), r'phys-bits too low')
>> 
>>    # now lets test some 64-bit CPU cases.
>> @@ -179,7 +179,7 @@ def test_phybits_low_tcg_q35_70_amd(self):
>>        self.vm.set_qmp_monitor(enabled=False)
>>        self.vm.launch()
>>        self.vm.wait()
>> -        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>> +        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>>        self.assertRegex(self.vm.get_log(), r'phys-bits too low')
>> 
>>    def test_phybits_low_tcg_q35_71_amd(self):
>> @@ -202,7 +202,7 @@ def test_phybits_low_tcg_q35_71_amd(self):
>>        self.vm.set_qmp_monitor(enabled=False)
>>        self.vm.launch()
>>        self.vm.wait()
>> -        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>> +        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>>        self.assertRegex(self.vm.get_log(), r'phys-bits too low')
>> 
>>    def test_phybits_ok_tcg_q35_70_amd(self):
>> @@ -288,7 +288,7 @@ def test_phybits_low_tcg_q35_71_amd_41bits(self):
>>        self.vm.set_qmp_monitor(enabled=False)
>>        self.vm.launch()
>>        self.vm.wait()
>> -        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>> +        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>>        self.assertRegex(self.vm.get_log(), r'phys-bits too low')
>> 
>>    def test_phybits_ok_tcg_q35_71_amd_41bits(self):
>> @@ -332,7 +332,7 @@ def test_phybits_low_tcg_q35_intel_cxl(self):
>>        self.vm.set_qmp_monitor(enabled=False)
>>        self.vm.launch()
>>        self.vm.wait()
>> -        self.assertEquals(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>> +        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
>>        self.assertRegex(self.vm.get_log(), r'phys-bits too low')
>> 
>>    def test_phybits_ok_tcg_q35_intel_cxl(self):
>> -- 
>> 2.41.0
>> 
> 
Re: [PATCH] tests/avocado/mem-addr-space-check: Replace assertEquals() for Python 3.12
Posted by Philippe Mathieu-Daudé 1 year ago
On 16/11/23 07:19, Thomas Huth wrote:
> assertEquals() has been removed in Python 3.12 and should be replaced by
> assertEqual(). See: https://docs.python.org/3.12/whatsnew/3.12.html#id3
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   Note: The test has just been merged, that's why I missed this file in
>   my earlier patch that replaces the assertEquals()

Ah my bad! I was also wondering...

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

> 
>   tests/avocado/mem-addr-space-check.py | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)