1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-09 05:27:17 +00:00

unit tests: use f-strings (#10993)

This commit is contained in:
Alexei Znamensky 2025-10-27 12:32:33 +13:00 committed by GitHub
parent e177d1e61a
commit efad7a0d38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 54 additions and 78 deletions

View file

@ -20,8 +20,7 @@ class TestOpentelemetry(unittest.TestCase):
@patch('ansible_collections.community.general.plugins.callback.elastic.socket')
def setUp(self, mock_socket):
if sys.version_info < ELASTIC_MINIMUM_PYTHON_VERSION:
self.skipTest("Python %s+ is needed for Elastic" %
",".join(map(str, ELASTIC_MINIMUM_PYTHON_VERSION)))
self.skipTest(f"Python {'.'.join(map(str, ELASTIC_MINIMUM_PYTHON_VERSION))}+ is needed for Elastic")
mock_socket.gethostname.return_value = 'my-host'
mock_socket.gethostbyname.return_value = '1.2.3.4'
self.elastic = ElasticSource(display=None)

View file

@ -21,8 +21,7 @@ class TestOpentelemetry(unittest.TestCase):
def setUp(self, mock_socket):
# TODO: this python version validation won't be needed as long as the _time_ns call is mocked.
if sys.version_info < OPENTELEMETRY_MINIMUM_PYTHON_VERSION:
self.skipTest("Python %s+ is needed for OpenTelemetry" %
",".join(map(str, OPENTELEMETRY_MINIMUM_PYTHON_VERSION)))
self.skipTest(f"Python {'.'.join(map(str, OPENTELEMETRY_MINIMUM_PYTHON_VERSION))}+ is needed for OpenTelemetry")
mock_socket.gethostname.return_value = 'my-host'
mock_socket.gethostbyname.return_value = '1.2.3.4'