opendev: bumped gates to python 3.9/3.10
Python 3.6/3.7 are no longer supported for the latest releasese of the OpenStack packages like oslo or coverage, thus switching to the Zed OpenStack release gates, which have support for 3.8/3.9/3.10 Python versions. For gates to pass, the docs required a defined language to be set ("en"), while the crypto unit tests required a method signature fix when running on Python 3.9/3.10. The version test__check_latest_version* unit tests started failing in a transient pattern because of the pbr.version.VersionInfo().release_string() throwing the following error: "NotImplementedError: cannot instantiate 'WindowsPath' on your system". This required to have the cloudbaseinit.version.get_version mocked for a reliable unit test run on Linux. Change-Id: I4748d1258c072c377825474e1116347b0a085c56
This commit is contained in:
parent
f8479e5cbc
commit
1a32d738de
@ -2,7 +2,7 @@
|
||||
templates:
|
||||
- openstack-cover-jobs
|
||||
- build-openstack-docs-pti
|
||||
- openstack-python3-ussuri-jobs
|
||||
- openstack-python3-zed-jobs
|
||||
- build-release-notes-jobs-python3
|
||||
post:
|
||||
jobs:
|
||||
|
@ -78,8 +78,9 @@ class TestVersion(unittest.TestCase):
|
||||
thread = mock_thread.return_value
|
||||
thread.start.assert_called_once_with()
|
||||
|
||||
@mock.patch('cloudbaseinit.version.get_version')
|
||||
@mock.patch('cloudbaseinit.version._read_url')
|
||||
def test__check_latest_version(self, mock_read_url):
|
||||
def test__check_latest_version(self, mock_read_url, mock_ver):
|
||||
mock_read_url.return_value = {'new_version': 42}
|
||||
mock_callback = mock.Mock()
|
||||
|
||||
@ -87,8 +88,9 @@ class TestVersion(unittest.TestCase):
|
||||
|
||||
mock_callback.assert_called_once_with(42)
|
||||
|
||||
@mock.patch('cloudbaseinit.version.get_version')
|
||||
@mock.patch('cloudbaseinit.version._read_url')
|
||||
def test__check_latest_version_fails(self, mock_read_url):
|
||||
def test__check_latest_version_fails(self, mock_read_url, mock_ver):
|
||||
mock_read_url.side_effect = Exception('no worky')
|
||||
mock_callback = mock.Mock()
|
||||
|
||||
@ -99,8 +101,9 @@ class TestVersion(unittest.TestCase):
|
||||
self.assertEqual(expected_logging, snatcher.output)
|
||||
self.assertFalse(mock_callback.called)
|
||||
|
||||
@mock.patch('cloudbaseinit.version.get_version')
|
||||
@mock.patch('cloudbaseinit.version._read_url')
|
||||
def test__check_latest_version_no_content(self, mock_read_url):
|
||||
def test__check_latest_version_no_content(self, mock_read_url, mock_ver):
|
||||
mock_read_url.return_value = None
|
||||
mock_callback = mock.Mock()
|
||||
|
||||
@ -108,8 +111,10 @@ class TestVersion(unittest.TestCase):
|
||||
|
||||
self.assertFalse(mock_callback.called)
|
||||
|
||||
@mock.patch('cloudbaseinit.version.get_version')
|
||||
@mock.patch('cloudbaseinit.version._read_url')
|
||||
def test__check_latest_version_no_new_version(self, mock_read_url):
|
||||
def test__check_latest_version_no_new_version(
|
||||
self, mock_read_url, mock_ver):
|
||||
mock_read_url.return_value = {'new_versio': 42}
|
||||
mock_callback = mock.Mock()
|
||||
|
||||
|
@ -23,9 +23,10 @@ class TestOpenSSLException(unittest.TestCase):
|
||||
self._openssl = crypt.OpenSSLException()
|
||||
|
||||
def test_get_openssl_error_msg(self):
|
||||
expected_error_msg = u'error:00000000:lib(0):func(0):reason(0)'
|
||||
error_msg = self._openssl._get_openssl_error_msg()
|
||||
self.assertEqual(expected_error_msg, error_msg)
|
||||
expected_err_msg = u'error:00000000:lib(0):func(0):reason(0)'
|
||||
expected_err_msg_py10 = u'error:00000000:lib(0)::reason(0)'
|
||||
err_msg = self._openssl._get_openssl_error_msg()
|
||||
self.assertIn(err_msg, [expected_err_msg, expected_err_msg_py10])
|
||||
|
||||
|
||||
class TestCryptManager(unittest.TestCase):
|
||||
|
@ -73,7 +73,7 @@ release = version
|
||||
#
|
||||
# This is also used if you do content translation via gettext catalogs.
|
||||
# Usually you set "language" from the command line for these cases.
|
||||
language = None
|
||||
language = "en"
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
|
@ -15,9 +15,9 @@ classifier =
|
||||
Operating System :: OS Independent
|
||||
Programming Language :: Python
|
||||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3.6
|
||||
Programming Language :: Python :: 3.7
|
||||
Programming Language :: Python :: 3.8
|
||||
Programming Language :: Python :: 3.9
|
||||
Programming Language :: Python :: 3.10
|
||||
|
||||
[files]
|
||||
packages =
|
||||
|
Loading…
x
Reference in New Issue
Block a user