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: I632a0d78f165b5cf1ccd00bad34fbfeabde2d8fe
This commit is contained in:
Andreas Jaeger 2020-04-03 14:45:04 +02:00
parent 040498fdc4
commit bb1c4d635a
4 changed files with 13 additions and 10 deletions

View File

@ -59,7 +59,7 @@ class AodhShell(app.App):
version=__version__,
command_manager=AodhCommandManager('aodhclient'),
deferred_help=True,
)
)
self._client = None

View File

@ -42,7 +42,7 @@ class CliAlarmCreateTest(testtools.TestCase):
'--aggregation-method', 'last',
'--resource-type', 'generic',
'--threshold', '80'
])
])
self.cli_alarm_create._validate_args(test_parsed_args)
mock_arg.assert_called_once_with(
'gnocchi_resources_threshold requires --metric, '
@ -58,7 +58,7 @@ class CliAlarmCreateTest(testtools.TestCase):
'--name', 'threshold_test',
'--type', 'threshold',
'--threshold', '80'
])
])
self.cli_alarm_create._validate_args(test_parsed_args)
mock_arg.assert_called_once_with(
'Threshold alarm requires -m/--meter-name and '
@ -73,7 +73,7 @@ class CliAlarmCreateTest(testtools.TestCase):
test_parsed_args = parser.parse_args([
'--name', 'composite_test',
'--type', 'composite'
])
])
self.cli_alarm_create._validate_args(test_parsed_args)
mock_arg.assert_called_once_with(
'Composite alarm requires --composite-rule parameter')
@ -90,7 +90,7 @@ class CliAlarmCreateTest(testtools.TestCase):
'--aggregation-method', 'last',
'--resource-type', 'generic',
'--threshold', '80'
])
])
self.cli_alarm_create._validate_args(test_parsed_args)
mock_arg.assert_called_once_with(
'gnocchi_aggregation_by_resources_threshold requires '
@ -107,7 +107,7 @@ class CliAlarmCreateTest(testtools.TestCase):
'--type', 'gnocchi_aggregation_by_metrics_threshold',
'--resource-type', 'generic',
'--threshold', '80'
])
])
self.cli_alarm_create._validate_args(test_parsed_args)
mock_arg.assert_called_once_with(
'gnocchi_aggregation_by_metrics_threshold requires '
@ -145,7 +145,7 @@ class CliAlarmCreateTest(testtools.TestCase):
'--stack-id', '0809ab348-8b0e-451c-be28-abe250ae9c1c',
'--pool-id', '79832aabf-343ba-be28-abe250ae9c1c',
'--autoscaling-group-id', 'abe250ae9c1c-79832aabf-343ba-be28'
])
])
# Output for the test
alarm = {
@ -217,7 +217,7 @@ class CliAlarmCreateTest(testtools.TestCase):
},
'composite_rule': None,
'type': 'event'
}
}
alarm_rep = self.cli_alarm_create._alarm_from_args(test_parsed_args)
self.assertEqual(alarm, alarm_rep)

View File

@ -25,7 +25,7 @@ operator = pp.Regex(u"|".join(binary_operator))
null = pp.Regex("None|none|null").setParseAction(pp.replaceWith(None))
boolean = "False|True|false|true"
boolean = pp.Regex(boolean).setParseAction(lambda t: t[0].lower() == "true")
hex_string = lambda n: pp.Word(pp.hexnums, exact=n)
hex_string = lambda n: pp.Word(pp.hexnums, exact=n) # noqa: E731
uuid = pp.Combine(hex_string(8) + ("-" + hex_string(4)) * 3 +
"-" + hex_string(12))
number = r"[+-]?\d+(:?\.\d*)?(:?[eE][+-]?\d+)?"

View File

@ -21,7 +21,7 @@ deps =
commands = pifpaf run aodh -- stestr run --slowest {posargs}
[testenv:pep8]
deps = hacking<0.13,>=0.12
deps = hacking<3.1.0,>=3.0
commands = flake8
[testenv:venv]
@ -55,4 +55,7 @@ commands = pifpaf --debug run aodh -- oslo_debug_helper {posargs}
[flake8]
show-source = True
# W503 line break before binary operator
# W504 line break after binary operator
ignore = W503,W504
exclude=.venv,.git,.tox,dist,doc,*egg,build