Browse Source

Update hacking for Python3

The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Remove hacking and friends from lower-constraints, they are not needed
for installation.

Change-Id: I02169e2f5bba669182d41a25bef1057306f74be8
changes/09/716909/1
Andreas Jaeger 11 months ago
parent
commit
82bf693bdf
18 changed files with 25 additions and 27 deletions
  1. +0
    -5
      lower-constraints.txt
  2. +1
    -1
      test-requirements.txt
  3. +5
    -0
      tox.ini
  4. +6
    -6
      tricircle/api/controllers/job.py
  5. +1
    -0
      tricircle/cmd/manage.py
  6. +1
    -0
      tricircle/cmd/status.py
  7. +1
    -0
      tricircle/cmd/xjob.py
  8. +1
    -1
      tricircle/common/exceptions.py
  9. +1
    -0
      tricircle/common/serializer.py
  10. +1
    -1
      tricircle/db/models.py
  11. +1
    -1
      tricircle/tests/unit/api/controllers/test_job.py
  12. +2
    -2
      tricircle/tests/unit/api/controllers/test_routing.py
  13. +0
    -2
      tricircle/tests/unit/network/test_central_plugin.py
  14. +1
    -1
      tricircle/tests/unit/network/test_central_sfc_plugin.py
  15. +0
    -2
      tricircle/tests/unit/network/test_central_trunk_driver.py
  16. +0
    -2
      tricircle/tests/unit/network/test_central_trunk_plugin.py
  17. +1
    -1
      tricircle/tests/unit/utils.py
  18. +2
    -2
      tricircle/tests/unit/xjob/test_xmanager.py

+ 0
- 5
lower-constraints.txt View File

@ -23,14 +23,11 @@ eventlet==0.18.2
extras==1.0.0
fasteners==0.7.0
fixtures==3.0.0
flake8-import-order==0.12
flake8==2.6.2
future==0.16.0
futurist==1.2.0
gitdb==0.6.4
GitPython==1.0.1
greenlet==0.4.10
hacking==1.1.0
httplib2==0.9.1
imagesize==0.7.1
iso8601==0.1.11
@ -93,7 +90,6 @@ Paste==2.0.2
PasteDeploy==1.5.0
pbr==4.0.0
pecan==1.3.2
pep8==1.5.7
pika-pool==0.1.3
pika==0.10.0
positional==1.2.1
@ -102,7 +98,6 @@ psutil==3.2.2
pycadf==1.1.0
pycodestyle==2.4.0
pycparser==2.18
pyflakes==0.8.1
Pygments==2.2.0
pyinotify==0.9.6
pylint==2.2.0


+ 1
- 1
test-requirements.txt View File

@ -1,7 +1,7 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
hacking>=3.0,<3.1.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
mock>=3.0.0 # BSD


+ 5
- 0
tox.ini View File

@ -67,6 +67,11 @@ builtins = _
# H106: Don't put vim configuration in source files
# H203: Use assertIs(Not)None to check for None
enable-extensions=H106,H203
# E123 closing bracket does not match indentation of opening bracket's line
# E402 module level import not at top of file
# W503 line break before binary operator
# W504 line break after binary operator
ignore = E123,E402,W503,W504
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
[hacking]


+ 6
- 6
tricircle/api/controllers/job.py View File

@ -84,13 +84,13 @@ class AsyncJobController(rest.RestController):
redundant_fields = request_fields - require_fields
if missing_fields:
return utils.format_api_error(
400, _('Some required fields are not specified:'
' %(field)s') % {'field': missing_fields})
return utils.format_api_error(
400, _('Some required fields are not specified:'
' %(field)s') % {'field': missing_fields})
if redundant_fields:
return utils.format_api_error(
400, _('Some fields are redundant: %(field)s') % {
'field': redundant_fields})
return utils.format_api_error(
400, _('Some fields are redundant: %(field)s') % {
'field': redundant_fields})
# validate whether the project id is legal
resource_type_1, resource_id_1 = (


+ 1
- 0
tricircle/cmd/manage.py View File

@ -43,6 +43,7 @@ def add_command_parsers(subparsers):
parser.set_defaults(func=do_db_sync)
parser.add_argument('version', nargs='?')
command_opt = cfg.SubCommandOpt('command',
title='Commands',
help='Show available commands.',


+ 1
- 0
tricircle/cmd/status.py View File

@ -50,5 +50,6 @@ def main():
return upgradecheck.main(
cfg.CONF, project='tricircle', upgrade_command=Checks())
if __name__ == '__main__':
sys.exit(main())

+ 1
- 0
tricircle/cmd/xjob.py View File

@ -53,5 +53,6 @@ def main():
xservice.wait()
if __name__ == '__main__':
main()

+ 1
- 1
tricircle/common/exceptions.py View File

@ -90,7 +90,7 @@ class TricircleException(Exception):
def _should_format(self):
if self.kwargs['message'] is None and '%(message)' in self.message:
LOG.error('\%(message)s in message '
LOG.error(r'\%(message)s in message '
'but init parameter is None')
return self.kwargs['message'] is None or '%(message)' in self.message


+ 1
- 0
tricircle/common/serializer.py View File

@ -26,6 +26,7 @@ class Mapping(object):
for key, value in six.iteritems(mapping):
self.reverse_mapping[value] = key
_SINGLETON_MAPPING = Mapping({
ATTR_NOT_SPECIFIED: "@@**ATTR_NOT_SPECIFIED**@@",
})


+ 1
- 1
tricircle/db/models.py View File

@ -154,7 +154,7 @@ class DeletingResources(core.ModelBase, core.DictBase):
__table_args__ = (
schema.UniqueConstraint(
'resource_id', 'resource_type',
'resource_id', 'resource_type',
name='deleting_resources0resource_id0resource_type'),
)


+ 1
- 1
tricircle/tests/unit/api/controllers/test_job.py View File

@ -482,7 +482,7 @@ class AsyncJobControllerTest(base.TestCase):
# test marker and limit
limit = 2
pt = '/v1.0/jobs\?limit=\w+&marker=([\w-]+)'
pt = r'/v1.0/jobs\?limit=\w+&marker=([\w-]+)'
job_paginate_filter = {'status': 'new', 'limit': limit}
res = self.controller.get_all(**job_paginate_filter)
while 'jobs_links' in res:


+ 2
- 2
tricircle/tests/unit/api/controllers/test_routing.py View File

@ -173,7 +173,7 @@ class RoutingControllerTest(base.TestCase):
self.assertEqual(1, len(items))
# test when pagination limit varies in range [1, total_routings+1)
for i in xrange(1, total_routings+1):
for i in xrange(1, total_routings + 1):
routings = []
total_pages = 0
@ -201,7 +201,7 @@ class RoutingControllerTest(base.TestCase):
self.assertEqual(pages, total_pages)
self.assertEqual(total_routings - 1, len(routings))
for i in xrange(total_routings-1):
for i in xrange(total_routings - 1):
self.assertEqual(total_routings - i, routings[i]['id'])
set1 = set(['router', 'security_group', 'network'])


+ 0
- 2
tricircle/tests/unit/network/test_central_plugin.py View File

@ -1530,8 +1530,6 @@ class PluginTest(unittest.TestCase,
'id': b_port_id,
'name': b_port_id,
'description': 'old_bottom_description',
'extra_dhcp_opts': [],
'device_owner': device_onwer,
'security_groups': [],
'device_id': '68f46ee4-d66a-4c39-bb34-ac2e5eb85470',
'admin_state_up': True,


+ 1
- 1
tricircle/tests/unit/network/test_central_sfc_plugin.py View File

@ -138,7 +138,7 @@ class FakeClient(test_utils.FakeClient):
if not pp:
raise client_exceptions.NotFound()
if pp['portpairgroup_id']:
raise client_exceptions.Conflict(constants.STR_IN_USE)
raise client_exceptions.Conflict(constants.STR_IN_USE)
elif _type == constants.RT_FLOW_CLASSIFIER:
pc_list = self._res_map[self.region_name][constants.RT_PORT_CHAIN]
for pc in pc_list:


+ 0
- 2
tricircle/tests/unit/network/test_central_trunk_driver.py View File

@ -299,8 +299,6 @@ class PluginTest(unittest.TestCase):
'id': t_port_id,
'name': t_port_id,
'description': 'old_bottom_description',
'extra_dhcp_opts': [],
'device_owner': device_onwer,
'security_groups': [],
'device_id': '68f46ee4-d66a-4c39-bb34-ac2e5eb85470',
'admin_state_up': True,


+ 0
- 2
tricircle/tests/unit/network/test_central_trunk_plugin.py View File

@ -299,8 +299,6 @@ class PluginTest(unittest.TestCase):
'id': t_port_id,
'name': t_port_id,
'description': 'old_bottom_description',
'extra_dhcp_opts': [],
'device_owner': device_onwer,
'security_groups': [],
'device_id': '68f46ee4-d66a-4c39-bb34-ac2e5eb85470',
'admin_state_up': True,


+ 1
- 1
tricircle/tests/unit/utils.py View File

@ -621,7 +621,7 @@ class FakeClient(object):
return None
def delete_resources(self, _type, ctx, _id):
if _type is 'policy':
if _type == 'policy':
_type = 'qos_policy'
index = -1
res_list = self._res_map[self.region_name][_type]


+ 2
- 2
tricircle/tests/unit/xjob/test_xmanager.py View File

@ -624,9 +624,9 @@ class XManagerTest(unittest.TestCase):
'net2_pod2_inf': '10.0.2.3',
'net3_pod1_inf': '10.0.3.5',
'net3_pod2_inf': '10.0.3.6'}
get_gw_map = lambda n_idx, p_idx: gw_map[
get_gw_map = lambda n_idx, p_idx: gw_map[ # noqa: E731
'net%d_pod%d_gw' % (n_idx, p_idx)]
get_inf_map = lambda n_idx, p_idx: inf_map[
get_inf_map = lambda n_idx, p_idx: inf_map[ # noqa: E731
'net%d_pod%d_inf' % (n_idx, p_idx)]
bridge_infos = []


Loading…
Cancel
Save