mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-24 21:14:00 -07:00
[PR #7348/6c9713b3 backport][stable-7] Fix Python 3.12 unit tests (#7351)
Fix Python 3.12 unit tests (#7348)
* Re-enable Python 3.12 unit tests.
* Stop using deprecated alias.
* Stop using long deprecated subset comparison function.
* Avoid another alias.
* Fix name, add Python 2 compatibility.
* Properly make backwards compatible.
(cherry picked from commit 6c9713b36c)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
551e5e4bd5
commit
3cb9b0fa91
9 changed files with 55 additions and 41 deletions
|
|
@ -30,7 +30,7 @@ class TestPkginQueryPackage(unittest.TestCase):
|
|||
command_result = pkgin.query_package(mock_module, package)
|
||||
|
||||
# then
|
||||
self.assertEquals(command_result, pkgin.PackageState.PRESENT)
|
||||
self.assertEqual(command_result, pkgin.PackageState.PRESENT)
|
||||
|
||||
@mock.patch('ansible_collections.community.general.plugins.modules.pkgin.AnsibleModule')
|
||||
def test_package_with_version_is_present(self, mock_module):
|
||||
|
|
@ -46,7 +46,7 @@ class TestPkginQueryPackage(unittest.TestCase):
|
|||
command_result = pkgin.query_package(mock_module, package)
|
||||
|
||||
# then
|
||||
self.assertEquals(command_result, pkgin.PackageState.PRESENT)
|
||||
self.assertEqual(command_result, pkgin.PackageState.PRESENT)
|
||||
|
||||
@mock.patch('ansible_collections.community.general.plugins.modules.pkgin.AnsibleModule')
|
||||
def test_package_found_but_not_installed(self, mock_module):
|
||||
|
|
@ -62,7 +62,7 @@ class TestPkginQueryPackage(unittest.TestCase):
|
|||
command_result = pkgin.query_package(mock_module, package)
|
||||
|
||||
# then
|
||||
self.assertEquals(command_result, pkgin.PackageState.NOT_INSTALLED)
|
||||
self.assertEqual(command_result, pkgin.PackageState.NOT_INSTALLED)
|
||||
|
||||
@mock.patch('ansible_collections.community.general.plugins.modules.pkgin.AnsibleModule')
|
||||
def test_package_found_outdated(self, mock_module):
|
||||
|
|
@ -78,7 +78,7 @@ class TestPkginQueryPackage(unittest.TestCase):
|
|||
command_result = pkgin.query_package(mock_module, package)
|
||||
|
||||
# then
|
||||
self.assertEquals(command_result, pkgin.PackageState.OUTDATED)
|
||||
self.assertEqual(command_result, pkgin.PackageState.OUTDATED)
|
||||
|
||||
@mock.patch('ansible_collections.community.general.plugins.modules.pkgin.AnsibleModule')
|
||||
def test_package_with_version_found_outdated(self, mock_module):
|
||||
|
|
@ -94,7 +94,7 @@ class TestPkginQueryPackage(unittest.TestCase):
|
|||
command_result = pkgin.query_package(mock_module, package)
|
||||
|
||||
# then
|
||||
self.assertEquals(command_result, pkgin.PackageState.OUTDATED)
|
||||
self.assertEqual(command_result, pkgin.PackageState.OUTDATED)
|
||||
|
||||
@mock.patch('ansible_collections.community.general.plugins.modules.pkgin.AnsibleModule')
|
||||
def test_package_not_found(self, mock_module):
|
||||
|
|
@ -110,7 +110,7 @@ class TestPkginQueryPackage(unittest.TestCase):
|
|||
command_result = pkgin.query_package(mock_module, package)
|
||||
|
||||
# then
|
||||
self.assertEquals(command_result, pkgin.PackageState.NOT_FOUND)
|
||||
self.assertEqual(command_result, pkgin.PackageState.NOT_FOUND)
|
||||
|
||||
@mock.patch('ansible_collections.community.general.plugins.modules.pkgin.AnsibleModule')
|
||||
def test_with_parseable_flag_supported_package_is_present(self, mock_module):
|
||||
|
|
@ -126,7 +126,7 @@ class TestPkginQueryPackage(unittest.TestCase):
|
|||
command_result = pkgin.query_package(mock_module, package)
|
||||
|
||||
# then
|
||||
self.assertEquals(command_result, pkgin.PackageState.PRESENT)
|
||||
self.assertEqual(command_result, pkgin.PackageState.PRESENT)
|
||||
|
||||
@mock.patch('ansible_collections.community.general.plugins.modules.pkgin.AnsibleModule')
|
||||
def test_with_parseable_flag_not_supported_package_is_present(self, mock_module):
|
||||
|
|
@ -142,4 +142,4 @@ class TestPkginQueryPackage(unittest.TestCase):
|
|||
command_result = pkgin.query_package(mock_module, package)
|
||||
|
||||
# then
|
||||
self.assertEquals(command_result, pkgin.PackageState.PRESENT)
|
||||
self.assertEqual(command_result, pkgin.PackageState.PRESENT)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue