From 089a307db1fc572461eea1589f1876132c058311 Mon Sep 17 00:00:00 2001 From: Paride Legovini Date: Tue, 21 Sep 2021 22:28:30 +0200 Subject: tox: bump the pinned flake8 and pylint version (#1029) tox: bump the pinned flake8 and pylint version * pylint: fix W1406 (redundant-u-string-prefix) The u prefix for strings is no longer necessary in Python >=3.0. * pylint: disable W1514 (unspecified-encoding) From https://www.python.org/dev/peps/pep-0597/ (Python 3.10): The new warning stems form https://www.python.org/dev/peps/pep-0597, which says: Developers using macOS or Linux may forget that the default encoding is not always UTF-8. [...] Even Python experts may assume that the default encoding is UTF-8. This creates bugs that only happen on Windows. The warning could be fixed by always specifying encoding='utf-8', however we should be careful to not break environments which are not utf-8 (or explicitly state that only utf-8 is supported). Let's silence the warning for now. * _quick_read_instance_id: cover the case where load_yaml() returns None Spotted by pylint: - E1135 (unsupported-membership-test) - E1136 (unsubscriptable-object) LP: #1944414 --- tests/unittests/test_datasource/test_scaleway.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'tests/unittests/test_datasource/test_scaleway.py') diff --git a/tests/unittests/test_datasource/test_scaleway.py b/tests/unittests/test_datasource/test_scaleway.py index 32f3274a..f9e968c5 100644 --- a/tests/unittests/test_datasource/test_scaleway.py +++ b/tests/unittests/test_datasource/test_scaleway.py @@ -209,9 +209,9 @@ class TestDataSourceScaleway(HttprettyTestCase): self.assertEqual(self.datasource.get_instance_id(), MetadataResponses.FAKE_METADATA['id']) self.assertEqual(self.datasource.get_public_ssh_keys().sort(), [ - u'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABCCCCC', - u'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABDDDDD', - u'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABA', + 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABCCCCC', + 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABDDDDD', + 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABA', ].sort()) self.assertEqual(self.datasource.get_hostname(), MetadataResponses.FAKE_METADATA['hostname']) @@ -242,8 +242,8 @@ class TestDataSourceScaleway(HttprettyTestCase): ] self.datasource.metadata['ssh_public_keys'] = [] self.assertEqual(self.datasource.get_public_ssh_keys().sort(), [ - u'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABDDDDD', - u'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABCCCCC', + 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABDDDDD', + 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABCCCCC', ].sort()) def test_ssh_keys_only_conf(self): @@ -260,9 +260,9 @@ class TestDataSourceScaleway(HttprettyTestCase): 'fingerprint': '2048 06:ff:... login2 (RSA)' }] self.assertEqual(self.datasource.get_public_ssh_keys().sort(), [ - u'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABCCCCC', - u'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABDDDDD', - u'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABA', + 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABCCCCC', + 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABDDDDD', + 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABA', ].sort()) def test_ssh_keys_both(self): @@ -282,9 +282,9 @@ class TestDataSourceScaleway(HttprettyTestCase): 'fingerprint': '2048 06:ff:... login2 (RSA)' }] self.assertEqual(self.datasource.get_public_ssh_keys().sort(), [ - u'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABCCCCC', - u'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABDDDDD', - u'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABA', + 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABCCCCC', + 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABDDDDD', + 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABA', ].sort()) @mock.patch('cloudinit.sources.DataSourceScaleway.EphemeralDHCPv4') -- cgit v1.2.3