From 867c9dd8b9bf2bb37fa6a5d59092004eec16fca6 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 23 Jun 2025 22:41:29 +0900 Subject: [PATCH] Drop test logic for Python < 3.8 ... because these old versions are no longer supported. Change-Id: Ic07384ed5d4f719e78a835d6815ca87bece6f129 --- .../resources/systems/test_libvirt.py | 83 +++++-------------- 1 file changed, 19 insertions(+), 64 deletions(-) diff --git a/sushy_tools/tests/unit/emulator/resources/systems/test_libvirt.py b/sushy_tools/tests/unit/emulator/resources/systems/test_libvirt.py index f3f375b5..c2324ffe 100644 --- a/sushy_tools/tests/unit/emulator/resources/systems/test_libvirt.py +++ b/sushy_tools/tests/unit/emulator/resources/systems/test_libvirt.py @@ -10,7 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -import sys from unittest import mock import uuid import xml.etree.ElementTree as ET @@ -266,17 +265,10 @@ class LibvirtDriverTestCase(base.BaseTestCase): conn_mock.defineXML.assert_called_once_with(mock.ANY) - expected = '\n \n \n \n' - # NOTE(rpittau): starting from Python 3.8 the tostring() function - # preserves the attribute order specified by the user. - if sys.version_info[1] >= 8: - expected = '\n \n \n \n' - self.assertIn(expected, conn_mock.defineXML.call_args[0][0]) @mock.patch('libvirt.openReadOnly', autospec=True) @@ -312,20 +304,10 @@ class LibvirtDriverTestCase(base.BaseTestCase): expected = '\n \n \n \n
\n ' \ + 'tio" />\n
\n ' \ '' - # NOTE(rpittau): starting from Python 3.8 the tostring() function - # preserves the attribute order specified by the user. - if sys.version_info[1] >= 8: - expected = '\n \n \n \n
\n ' \ - '' - self.assertIn(expected, conn_mock.defineXML.call_args[0][0]) @mock.patch('libvirt.open', autospec=True) @@ -661,18 +643,10 @@ class LibvirtDriverTestCase(base.BaseTestCase): volume_mock = pool_mock.createXML.return_value volume_mock.upload.assert_called_once_with(mock.ANY, 0, mock.ANY) - expected_disk = ('' - '' - '
') - - # NOTE(rpittau): starting from Python 3.8 the tostring() function - # preserves the attribute order specified by the user. - if sys.version_info[1] >= 8: - expected_disk = ('' - '' - '
') + expected_disk = ('' + '' + '
') self.assertEqual(1, conn_mock.defineXML.call_count) self.assertIn(expected_disk, conn_mock.defineXML.call_args[0][0]) @@ -719,13 +693,10 @@ class LibvirtDriverTestCase(base.BaseTestCase): '
') - # NOTE(rpittau): starting from Python 3.8 the tostring() function - # preserves the attribute order specified by the user. - if sys.version_info[1] >= 8: - expected_disk = ('' - '' - '
') + expected_disk = ('' + '' + '
') self.assertEqual(1, conn_mock.defineXML.call_count) self.assertIn(expected_disk, conn_mock.defineXML.call_args[0][0]) @@ -767,18 +738,10 @@ class LibvirtDriverTestCase(base.BaseTestCase): volume_mock = pool_mock.createXML.return_value volume_mock.upload.assert_called_once_with(mock.ANY, 0, mock.ANY) - expected_disk = ('' - '' - '
') - - # NOTE(rpittau): starting from Python 3.8 the tostring() function - # preserves the attribute order specified by the user. - if sys.version_info[1] >= 8: - expected_disk = ('' - '' - '
') + expected_disk = ('' + '' + '
') self.assertEqual(1, conn_mock.defineXML.call_count) self.assertIn(expected_disk, conn_mock.defineXML.call_args[0][0]) @@ -820,18 +783,10 @@ class LibvirtDriverTestCase(base.BaseTestCase): volume_mock = pool_mock.createXML.return_value volume_mock.upload.assert_called_once_with(mock.ANY, 0, mock.ANY) - expected_disk = ('' - '' - '
') - - # NOTE(rpittau): starting from Python 3.8 the tostring() function - # preserves the attribute order specified by the user. - if sys.version_info[1] >= 8: - expected_disk = ('' - '' - '
') + expected_disk = ('' + '' + '
') self.assertEqual(1, conn_mock.defineXML.call_count) self.assertIn(expected_disk, conn_mock.defineXML.call_args[0][0])