Fix unit tests for py312
Needs liblzma-dev header files for installing Python3.12 from source. Also test functest update func-test-pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/1254 Change-Id: I13b8f95bd4f7360204a42991c276951e3c0c44db
This commit is contained in:
@@ -3,3 +3,4 @@ libxslt1-dev [platform:dpkg test]
|
||||
build-essential [platform:dpkg test]
|
||||
zlib1g-dev [platform:dpkg test]
|
||||
libffi-dev [platform:dpkg test]
|
||||
liblzma-dev [platform:dpkg test]
|
||||
|
@@ -2,14 +2,6 @@
|
||||
# within individual charm repos. See the 'global' dir contents for available
|
||||
# choices of *requirements.txt files for OpenStack Charms:
|
||||
# https://github.com/openstack-charmers/release-tools
|
||||
#
|
||||
# TODO: Distill the func test requirements from the lint/unit test
|
||||
# requirements. They are intertwined. Also, Zaza itself should specify
|
||||
# all of its own requirements and if it doesn't, fix it there.
|
||||
#
|
||||
pyparsing<3.0.0 # aodhclient is pinned in zaza and needs pyparsing < 3.0.0, but cffi also needs it, so pin here.
|
||||
cffi==1.14.6; python_version < '3.6' # cffi 1.15.0 drops support for py35.
|
||||
setuptools<50.0.0 # https://github.com/pypa/setuptools/commit/04e3df22df840c6bb244e9b27bc56750c44b7c85
|
||||
|
||||
# NOTE: newer versions of cryptography require a Rust compiler to build,
|
||||
# see
|
||||
|
5
tox.ini
5
tox.ini
@@ -74,6 +74,11 @@ basepython = python3.11
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
|
||||
[testenv:py312]
|
||||
basepython = python3.12
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
|
||||
[testenv:py3]
|
||||
basepython = python3
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
|
@@ -705,7 +705,7 @@ class BootstrapSourceTestCase(test_utils.CharmTestCase):
|
||||
for unit in ('ceph/0', 'ceph/1', 'ceph/2'):
|
||||
expected_calls.append(call('monitor-secret', unit, relid))
|
||||
expected_calls.append(call('fsid', unit, relid))
|
||||
self.relation_get.has_calls(expected_calls)
|
||||
self.relation_get.assert_has_calls(expected_calls)
|
||||
self.assertEqual(self.leader_set.call_count, 0)
|
||||
self.assertEqual(self.mon_relation.call_count, 0)
|
||||
|
||||
|
@@ -78,7 +78,7 @@ class CephUtilsTestCase(test_utils.CharmTestCase):
|
||||
{'a': 'b',
|
||||
'rbd_default_features': '61',
|
||||
'c': 'd'})
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
utils.get_default_rbd_features(),
|
||||
61)
|
||||
_check_output.assert_called_once_with(
|
||||
@@ -101,13 +101,13 @@ class CephUtilsTestCase(test_utils.CharmTestCase):
|
||||
_get_default_rbd_features):
|
||||
_config.side_effect = \
|
||||
lambda key: {'default-rbd-features': 42}.get(key, None)
|
||||
self.assertEquals(utils.get_rbd_features(), 42)
|
||||
self.assertEqual(utils.get_rbd_features(), 42)
|
||||
_has_rbd_mirrors.return_value = True
|
||||
_get_default_rbd_features.return_value = 61
|
||||
_config.side_effect = lambda key: {}.get(key, None)
|
||||
self.assertEquals(utils.get_rbd_features(), 125)
|
||||
self.assertEqual(utils.get_rbd_features(), 125)
|
||||
_has_rbd_mirrors.return_value = False
|
||||
self.assertEquals(utils.get_rbd_features(), None)
|
||||
self.assertEqual(utils.get_rbd_features(), None)
|
||||
|
||||
@mock.patch.object(utils, '_is_required_osd_release')
|
||||
@mock.patch.object(utils, '_all_ceph_versions_same')
|
||||
@@ -190,7 +190,7 @@ class CephUtilsTestCase(test_utils.CharmTestCase):
|
||||
self.assertFalse(
|
||||
return_bool,
|
||||
msg='all_ceph_versions_same returned True but should be False')
|
||||
self.assertEquals(log.call_count, 2)
|
||||
self.assertEqual(log.call_count, 2)
|
||||
|
||||
@mock.patch.object(utils.subprocess, 'check_output')
|
||||
@mock.patch.object(utils.json, 'loads')
|
||||
@@ -208,7 +208,7 @@ class CephUtilsTestCase(test_utils.CharmTestCase):
|
||||
self.assertFalse(
|
||||
return_bool,
|
||||
msg='all_ceph_versions_same returned True but should be False')
|
||||
self.assertEquals(log.call_count, 2)
|
||||
self.assertEqual(log.call_count, 2)
|
||||
|
||||
@mock.patch.object(utils.subprocess, 'check_output')
|
||||
@mock.patch.object(utils, 'log')
|
||||
@@ -241,9 +241,10 @@ class CephUtilsTestCase(test_utils.CharmTestCase):
|
||||
release = 'luminous'
|
||||
utils._set_require_osd_release(release)
|
||||
expected_call = mock.call(
|
||||
['ceph', 'osd', 'require-osd-release', release]
|
||||
['ceph', 'osd', 'require-osd-release', release,
|
||||
'--yes-i-really-mean-it']
|
||||
)
|
||||
check_call.has_calls(expected_call)
|
||||
check_call.assert_has_calls([expected_call])
|
||||
|
||||
@mock.patch.object(utils.subprocess, 'check_call')
|
||||
@mock.patch.object(utils, 'log')
|
||||
@@ -252,14 +253,15 @@ class CephUtilsTestCase(test_utils.CharmTestCase):
|
||||
check_call.side_effect = utils.subprocess.CalledProcessError(
|
||||
0, mock.MagicMock()
|
||||
)
|
||||
expected_call = mock.call(
|
||||
['ceph', 'osd', 'require-osd-release', release]
|
||||
)
|
||||
expected_call = mock.call([
|
||||
'ceph', 'osd', 'require-osd-release', release,
|
||||
'--yes-i-really-mean-it'
|
||||
])
|
||||
|
||||
with self.assertRaises(utils.OsdPostUpgradeError):
|
||||
utils._set_require_osd_release(release)
|
||||
|
||||
check_call.has_calls(expected_call)
|
||||
check_call.assert_has_calls([expected_call])
|
||||
log.assert_called_once()
|
||||
|
||||
@mock.patch.object(utils, 'relation_ids')
|
||||
|
Reference in New Issue
Block a user