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.

Change-Id: I82c745f5b1236844deec4538be84037a64eebeee
tags/2.1.0^0
Andreas Jaeger 3 months ago
committed by Andreas Jaeger
parent
commit
9dede4eb2b
10 changed files with 16 additions and 12 deletions
  1. +1
    -0
      doc/source/ext/gen_ref.py
  2. +2
    -2
      heatclient/common/event_utils.py
  3. +1
    -1
      heatclient/common/http.py
  4. +2
    -0
      heatclient/common/template_format.py
  5. +2
    -2
      heatclient/common/utils.py
  6. +1
    -0
      heatclient/shell.py
  7. +3
    -3
      heatclient/tests/unit/test_deployment_utils.py
  8. +2
    -2
      heatclient/tests/unit/test_shell.py
  9. +1
    -1
      heatclient/v1/shell.py
  10. +1
    -1
      test-requirements.txt

+ 1
- 0
doc/source/ext/gen_ref.py View File

@@ -53,6 +53,7 @@ def gen_ref(ver, title, names):
"signs": "=" * len(sec_title),
"pkg": pkg, "name": name})


gen_ref("", "Client Reference", {"client": "Client", "exc": "Exceptions"})
gen_ref("v1", "Version 1 API Reference",
{"stacks": "Stacks",


+ 2
- 2
heatclient/common/event_utils.py View File

@@ -182,9 +182,9 @@ def poll_for_events(hc, stack_name, action=None, poll_period=5, marker=None,

if action:
stop_status = ('%s_FAILED' % action, '%s_COMPLETE' % action)
stop_check = lambda a: a in stop_status
stop_check = lambda a: a in stop_status # noqa: E731
else:
stop_check = lambda a: a.endswith('_COMPLETE') or a.endswith('_FAILED')
stop_check = lambda a: a.endswith('_COMPLETE') or a.endswith('_FAILED') # noqa E731

no_event_polls = 0
msg_template = _("\n Stack %(name)s %(status)s \n")


+ 1
- 1
heatclient/common/http.py View File

@@ -340,7 +340,7 @@ class SessionClient(adapter.LegacyJsonAdapter):
raise exc.InvalidEndpoint(message=message)
if (self.endpoint_override is not None and
location.lower().startswith(self.endpoint_override.lower())):
return location[len(self.endpoint_override):]
return location[len(self.endpoint_override):]
else:
return location



+ 2
- 0
heatclient/common/template_format.py View File

@@ -39,6 +39,8 @@ def _construct_yaml_str(self, node):
# Override the default string handling function
# to always return unicode objects
return self.construct_scalar(node)


yaml_loader.add_constructor(u'tag:yaml.org,2002:str', _construct_yaml_str)
# Unquoted dates like 2013-05-23 in yaml files get loaded as objects of type
# datetime.data which causes problems in API layer when being processed by


+ 2
- 2
heatclient/common/utils.py View File

@@ -377,8 +377,8 @@ def format_parameter_file(param_files, template_file=None,

param_file = {}
for key, value in params.items():
param_file[key] = resolve_param_get_file(value,
template_base_url)
param_file[key] = resolve_param_get_file(value,
template_base_url)
return param_file




+ 1
- 0
heatclient/shell.py View File

@@ -615,5 +615,6 @@ def main(args=None):
print(encodeutils.safe_encode(six.text_type(e)), file=sys.stderr)
sys.exit(1)


if __name__ == "__main__":
main()

+ 3
- 3
heatclient/tests/unit/test_deployment_utils.py View File

@@ -291,9 +291,9 @@ class TempURLSignalTest(testtools.TestCase):
'[a-f0-9]{3}-[a-f0-9]{12}')
url = deployment_utils.create_temp_url(swift_client, 'bar', 60)
self.assertFalse(swift_client.post_account.called)
regexp = ("http://fake-host.com:8080/v1/AUTH_demo/bar-%s"
"/%s\?temp_url_sig=[0-9a-f]{40}&"
"temp_url_expires=[0-9]{10}" % (uuid_pattern, uuid_pattern))
regexp = (r"http://fake-host.com:8080/v1/AUTH_demo/bar-%s"
r"/%s\?temp_url_sig=[0-9a-f]{40}&"
r"temp_url_expires=[0-9]{10}" % (uuid_pattern, uuid_pattern))
self.assertThat(url, matchers.MatchesRegex(regexp))

timeout = int(url.split('=')[-1])


+ 2
- 2
heatclient/tests/unit/test_shell.py View File

@@ -557,7 +557,7 @@ class ShellTestNoMox(ShellTestNoMoxBase):
template_file = os.path.join(TEST_VAR_DIR, 'minimal.template')

self.shell_error('stack-create -f %s stack' % template_file,
'The Parameter \(key_name\) was not provided.',
r'The Parameter \(key_name\) was not provided.',
exception=exc.HTTPBadRequest)

def test_event_list(self):
@@ -2437,7 +2437,7 @@ class ShellTestUserPass(ShellBase):
'{',
'"output_key": "output2"',
'"description": "test output 2"',
'"output_value": \[',
r'"output_value": \[',
'"output"',
'"value"',
'"2"',


+ 1
- 1
heatclient/v1/shell.py View File

@@ -728,7 +728,7 @@ def do_output_list(hc, args):
utils.print_list(outputs['outputs'], fields, formatters=formatters)


@utils.arg('id', metavar='<NAME or ID>',
@utils.arg('id', metavar='<NAME or ID>', # noqa: C901
help=_('Name or ID of stack to query.'))
@utils.arg('output', metavar='<OUTPUT NAME>', nargs='?', default=None,
help=_('Name of an output to display.'))


+ 1
- 1
test-requirements.txt View File

@@ -3,7 +3,7 @@
# process, which may cause wedges in the gate later.

# Hacking already pins down pep8, pyflakes and flake8
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
requests-mock>=1.2.0 # Apache-2.0


Loading…
Cancel
Save