Fix flake8 errors

The patch addresses H214 and H904 standards.

Change-Id: I859477717089461c8bf10c9fe37d9078c7ad3279
changes/33/762733/1
Martin Kopec 2 years ago
parent a14491c0db
commit b26e4565da
  1. 6
      config_tempest/main.py
  2. 6
      config_tempest/services/network.py
  3. 3
      config_tempest/services/services.py
  4. 18
      config_tempest/tests/test_tempest_conf.py

@ -175,12 +175,10 @@ def set_options(conf, deployer_input, non_admin, image_path, overrides=[],
conf.set('image', 'image_path', image_path)
if deployer_input and os.path.isfile(deployer_input):
LOG.info("Reading deployer input from file {}".format(
deployer_input))
LOG.info("Reading deployer input from file %s", deployer_input)
read_deployer_input(deployer_input, conf)
elif os.path.isfile(C.DEPLOYER_INPUT) and not no_default_deployer:
LOG.info("Reading deployer input from file {}".format(
C.DEPLOYER_INPUT))
LOG.info("Reading deployer input from file %s", C.DEPLOYER_INPUT)
read_deployer_input(C.DEPLOYER_INPUT, conf)
if non_admin:

@ -49,8 +49,8 @@ class NetworkService(VersionedService):
return 'api_extensions'
def _supplied_network(self):
LOG.info("Looking for existing network id: {0}"
"".format(self._public_network_id))
LOG.info("Looking for existing network id: %s",
self._public_network_id)
# check if network exists
network_list = self.client.list_networks()
for network in network_list['networks']:
@ -66,7 +66,7 @@ class NetworkService(VersionedService):
network_list = self.client.list_networks()
for network in network_list['networks']:
if network['router:external'] and network['subnets']:
LOG.info("Found network, using: {0}".format(network['id']))
LOG.info("Found network, using: %s", network['id'])
self._public_network_id = network['id']
self._public_network_name = network['name']
break

@ -100,8 +100,7 @@ class Services(object):
service_data = self.get_service_data(s_name, s_type)
url = None
if not service_data:
C.LOG.warning('No endpoint data found for {}'.format(
s_name))
C.LOG.warning('No endpoint data found for %s', s_name)
else:
url = self.parse_endpoints(self.get_endpoints(
service_data), s_type)

@ -96,9 +96,9 @@ class TestTempestConf(BaseConfigTempestTest):
conf_exts = conf_exts.split(',')
for ext in api_exts.split(','):
if ext in remove_exts:
self.assertFalse(ext in conf_exts)
self.assertNotIn(ext, conf_exts)
else:
self.assertTrue(ext in conf_exts)
self.assertIn(ext, conf_exts)
def test_remove_values_having_hyphen(self):
api_exts = "dvr,l3-flavors,rbac-policies,project-id"
@ -113,9 +113,9 @@ class TestTempestConf(BaseConfigTempestTest):
conf_exts = conf_exts.split(',')
for ext in api_exts.split(','):
if ext in remove_exts:
self.assertFalse(ext in conf_exts)
self.assertNotIn(ext, conf_exts)
else:
self.assertTrue(ext in conf_exts)
self.assertIn(ext, conf_exts)
@mock.patch('config_tempest.tempest_conf.C.LOG')
def test_remove_not_defined_values(self, mock_logging):
@ -138,7 +138,7 @@ class TestTempestConf(BaseConfigTempestTest):
conf_exts = self.conf.get("compute-feature-enabled", "api_extensions")
conf_exts = conf_exts.split(',')
self.assertEqual(len(conf_exts), 4)
self.assertTrue("project-id" in conf_exts)
self.assertIn("project-id", conf_exts)
def test_append_values_with_overrides(self):
# Test if --add option can override an option which was
@ -159,7 +159,7 @@ class TestTempestConf(BaseConfigTempestTest):
# if there are still 3 extensions, no new was added
self.assertEqual(len(conf_exts), 3)
# option added via --add shouldn't be there
self.assertFalse("project-id" in conf_exts)
self.assertTrue("dvr" in conf_exts)
self.assertTrue("l3-flavors" in conf_exts)
self.assertTrue("rbac-policies" in conf_exts)
self.assertNotIn("project-id", conf_exts)
self.assertIn("dvr", conf_exts)
self.assertIn("l3-flavors", conf_exts)
self.assertIn("rbac-policies", conf_exts)

Loading…
Cancel
Save