Fix pep8 error when running tox
openstack-tox-pep8 now is failure, this patch is to fix this. Closes-bug: #1799930 Change-Id: Ia1b7f3395e92014e0f5373d81788dc55f7815002
This commit is contained in:
parent
95da742946
commit
0c34a4901d
|
@ -6,12 +6,12 @@
|
||||||
jobs:
|
jobs:
|
||||||
- build-openstack-releasenotes
|
- build-openstack-releasenotes
|
||||||
- openstack-tox-linters
|
- openstack-tox-linters
|
||||||
- openstack-tox-pep8:
|
- openstack-tox-pep8
|
||||||
voting: false
|
|
||||||
gate:
|
gate:
|
||||||
jobs:
|
jobs:
|
||||||
- build-openstack-releasenotes
|
- build-openstack-releasenotes
|
||||||
- openstack-tox-linters
|
- openstack-tox-linters
|
||||||
|
- openstack-tox-pep8
|
||||||
post:
|
post:
|
||||||
jobs:
|
jobs:
|
||||||
- publish-stx-api-ref
|
- publish-stx-api-ref
|
||||||
|
|
|
@ -26,6 +26,7 @@ DC Manager base exception handling.
|
||||||
"""
|
"""
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
from oslo_utils import encodeutils
|
||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
|
|
||||||
from dcmanager.common.i18n import _
|
from dcmanager.common.i18n import _
|
||||||
|
@ -54,7 +55,7 @@ class DCManagerException(Exception):
|
||||||
|
|
||||||
if six.PY2:
|
if six.PY2:
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return unicode(self.msg)
|
return encodeutils.exception_to_unicode(self.msg)
|
||||||
|
|
||||||
def use_fatal_exceptions(self):
|
def use_fatal_exceptions(self):
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -19,6 +19,7 @@ DC Orchestrator base exception handling.
|
||||||
"""
|
"""
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
from oslo_utils import encodeutils
|
||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
|
|
||||||
from dcorch.common.i18n import _
|
from dcorch.common.i18n import _
|
||||||
|
@ -47,7 +48,7 @@ class OrchestratorException(Exception):
|
||||||
|
|
||||||
if six.PY2:
|
if six.PY2:
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return unicode(self.msg)
|
return encodeutils.exception_to_unicode(self.msg)
|
||||||
|
|
||||||
def use_fatal_exceptions(self):
|
def use_fatal_exceptions(self):
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
|
import six
|
||||||
import tsconfig.tsconfig as tsc
|
import tsconfig.tsconfig as tsc
|
||||||
|
|
||||||
from cgtsclient import client as cgts_client
|
from cgtsclient import client as cgts_client
|
||||||
|
@ -402,7 +403,7 @@ class SysinvClient(base.DriverBase):
|
||||||
if k in self.REMOTELOGGING_PATCH_ATTRS:
|
if k in self.REMOTELOGGING_PATCH_ATTRS:
|
||||||
if k == 'action':
|
if k == 'action':
|
||||||
action_found = True
|
action_found = True
|
||||||
elif k == 'enabled' and not isinstance(v, basestring):
|
elif k == 'enabled' and not isinstance(v, six.string_types):
|
||||||
# api requires a string for enabled
|
# api requires a string for enabled
|
||||||
if not v:
|
if not v:
|
||||||
patch[k] = 'false'
|
patch[k] = 'false'
|
||||||
|
|
|
@ -66,8 +66,11 @@ def set_current_test_data(cfg):
|
||||||
|
|
||||||
|
|
||||||
def print_divider(width, txt):
|
def print_divider(width, txt):
|
||||||
width_new = (int(width) - len(txt)) / 2
|
width_new = (int(width) - len(txt)) // 2
|
||||||
print '%s%s%s' % ('_' * width_new, txt, '_' * width_new)
|
width_dash = '_' * width_new
|
||||||
|
print('%(width_dash)s%(txt)s%(width_dash)s', {'width_dash': width_dash,
|
||||||
|
'txt': txt,
|
||||||
|
'width_dash': width_dash})
|
||||||
|
|
||||||
|
|
||||||
def get_divider_size():
|
def get_divider_size():
|
||||||
|
@ -80,29 +83,28 @@ def get_divider_size():
|
||||||
|
|
||||||
# Get all repository information
|
# Get all repository information
|
||||||
data_dir = get_data_repo()
|
data_dir = get_data_repo()
|
||||||
print 'Using %s as data directory' % data_dir
|
print('Using %(data_dir)s as data directory', {'data_dir': data_dir})
|
||||||
|
|
||||||
cfgs = get_cfgs()
|
cfgs = get_cfgs()
|
||||||
cfgs_usable = filter_cfgs(cfgs)
|
cfgs_usable = filter_cfgs(cfgs)
|
||||||
print 'Required repo databases: %s' % os.environ.get('REQUIRED_REPOS')
|
repo = os.environ.get('REQUIRED_REPOS')
|
||||||
print "Test data folder(s) found: %s" % cfgs
|
print('Required repo databases: %(repo)s', {'repo': repo})
|
||||||
|
print("Test data folder(s) found: %(cfgs)s", {'cfgs': cfgs})
|
||||||
if len(cfgs_usable) == 0:
|
if len(cfgs_usable) == 0:
|
||||||
print 'No usable data sets found'
|
print('No usable data sets found')
|
||||||
exit
|
exit
|
||||||
|
|
||||||
print 'Usable data folder(s): %s' % cfgs_usable
|
print('Usable data folder(s): %(cfgs_usable)s', {'cfgs_usable': cfgs_usable})
|
||||||
if os.environ.get('SINGLE_REPO') == 'True':
|
if os.environ.get('SINGLE_REPO') == 'True':
|
||||||
cfgs_usable = [cfgs_usable[0]]
|
cfgs_usable = [cfgs_usable[0]]
|
||||||
print 'Restricting to single data set: %s' % cfgs_usable[0]
|
print('Restricting to single data set: %(cfgs)s', {'cfgs': cfgs_usable})
|
||||||
print ''
|
|
||||||
|
|
||||||
# Loop through all configurations and run unit tests with each
|
# Loop through all configurations and run unit tests with each
|
||||||
columns = get_divider_size()
|
columns = get_divider_size()
|
||||||
for cfg in cfgs_usable:
|
for cfg in cfgs_usable:
|
||||||
print_divider(columns, cfg)
|
print_divider(columns, cfg)
|
||||||
print 'Running unit tests with test data: %s' % cfg
|
print('Running unit tests with test data: %(cfg)s', {'cfg': cfg})
|
||||||
set_current_test_data(cfg)
|
set_current_test_data(cfg)
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
setup_requires=['pbr>=1.8.0'],
|
setup_requires=['pbr>=1.8.0'],
|
||||||
pbr=True)
|
pbr=True)
|
||||||
print ''
|
|
||||||
|
|
Loading…
Reference in New Issue