Fix issues with newer flake8

The updated flake8 seems to have fixed a check for .format() issues that
discovered a bug in one of our tests, which is fixed here.

Also get rid of using "l" as a variable name and tag the imports that
need to stay in order after setting an environment variable.

Change-Id: I28de0ffa68f9bff4685d81fe7b5a5d8909e2313c
This commit is contained in:
Dr. Jens Harbott
2020-05-12 14:39:03 +00:00
parent 814cc0aa51
commit 31884f77d5
3 changed files with 6 additions and 6 deletions

View File

@@ -19,9 +19,9 @@ import os
# the /etc/hosts file, causing problems for installs.
os.environ['EVENTLET_NO_GREENDNS'] = 'yes' # noqa
from oslo_log import log
from oslo_concurrency import lockutils
import oslo_messaging as messaging
from oslo_log import log # noqa
from oslo_concurrency import lockutils # noqa
import oslo_messaging as messaging # noqa
_EXTRA_DEFAULT_LOG_LEVELS = [
'kazoo.client=WARN',

View File

@@ -458,7 +458,7 @@ class CentralServiceTestCase(CentralBasic):
# we will hit it if we try to do the operations in a loop 100 times.
for num in range(100):
recordset = Mock()
recordset.name = "b%s".format(num)
recordset.name = "b{}".format(num)
recordset.obj_attr_is_set.return_value = True
recordset.records = [MockRecord()]

View File

@@ -61,10 +61,10 @@ designate_cli_path = '/usr/local/bin/designate'
openstack_cli = 'openstack'
def gen_random_name(l):
def gen_random_name(length):
return "".join(
random.choice(string.ascii_lowercase + string.digits)
for n in range(l)
for n in range(length)
)