Merge pull request #9743 from beeankha/fix_collections_linting_issues

Fix Collections Linting Errors (Format String Specifications)

Reviewed-by: Rebeccah Hunter <rhunter@redhat.com>
Reviewed-by: Christian Adams <rooftopcellist@gmail.com>
This commit is contained in:
softwarefactory-project-zuul[bot] 2021-03-29 20:50:18 +00:00 committed by GitHub
commit 3de04d33c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -266,8 +266,8 @@ class TowerAPIModule(TowerModule):
collection_compare_ver = parsed_collection_version[0]
tower_compare_ver = parsed_tower_version[0]
else:
collection_compare_ver = "{}.{}".format(parsed_collection_version[0], parsed_collection_version[1])
tower_compare_ver = '{}.{}'.format(parsed_tower_version[0], parsed_tower_version[1])
collection_compare_ver = "{0}.{1}".format(parsed_collection_version[0], parsed_collection_version[1])
tower_compare_ver = '{0}.{1}'.format(parsed_tower_version[0], parsed_tower_version[1])
if self._COLLECTION_TYPE not in self.collection_to_version or self.collection_to_version[self._COLLECTION_TYPE] != tower_type:
self.warn("You are using the {0} version of this collection but connecting to {1}".format(self._COLLECTION_TYPE, tower_type))

View File

@ -59,7 +59,7 @@ def test_version_warning(collection_import, silence_warning):
my_module._COLLECTION_TYPE = "awx"
my_module.get_endpoint('ping')
silence_warning.assert_called_once_with(
'You are running collection version {} but connecting to {} version {}'.format(my_module._COLLECTION_VERSION, awx_name, ping_version)
'You are running collection version {0} but connecting to {1} version {2}'.format(my_module._COLLECTION_VERSION, awx_name, ping_version)
)
@ -107,7 +107,7 @@ def test_version_warning_strictness_tower(collection_import, silence_warning):
my_module._COLLECTION_TYPE = "tower"
my_module.get_endpoint('ping')
silence_warning.assert_called_once_with(
'You are running collection version {} but connecting to {} version {}'.format(my_module._COLLECTION_VERSION, tower_name, ping_version)
'You are running collection version {0} but connecting to {1} version {2}'.format(my_module._COLLECTION_VERSION, tower_name, ping_version)
)
@ -121,7 +121,9 @@ def test_type_warning(collection_import, silence_warning):
my_module._COLLECTION_VERSION = ping_version
my_module._COLLECTION_TYPE = "tower"
my_module.get_endpoint('ping')
silence_warning.assert_called_once_with('You are using the {} version of this collection but connecting to {}'.format(my_module._COLLECTION_TYPE, awx_name))
silence_warning.assert_called_once_with(
'You are using the {0} version of this collection but connecting to {1}'.format(my_module._COLLECTION_TYPE, awx_name)
)
def test_duplicate_config(collection_import, silence_warning):