Resolve py27 and pep8 job failures

1. Cap version of stestr for py27 (the latest version is py3 only).

2. Flake8 is runtime dependency of diskimage-builder, currently they use
version >= 3.6.0, so Shaker must conform to this version too.

Failures found by the newer version of flake8:
 * W605 invalid escape sequence -- issues are fixed since they
   correspond to syntax warnings from py36.
 * E305 expected 2 blank lines after class or function definition --
   issues are fixed (older version didn't restrict spaces between
   functions and `if __name__ == "__main__":` block).
 * W504 line break after binary operator -- the rule is ignored since it
   contradicts the code style of the whole project.

Change-Id: I7fa53cfb6b654f5d93df30441a6eb2d47714d479
This commit is contained in:
Ilya Shakhat 2020-04-05 01:17:16 +04:00
parent cd540090dd
commit 9168689007
6 changed files with 11 additions and 10 deletions

View File

@ -169,5 +169,6 @@ def main():
work(agent_id, endpoint, polling_interval)
if __name__ == "__main__":
main()

View File

@ -61,5 +61,6 @@ def main():
LOG.info('Cleaning up')
image_builder.cleanup()
if __name__ == "__main__":
main()

View File

@ -37,7 +37,7 @@ class Endpoint(types.String):
def __call__(self, value):
value = str(value)
if not re.match('\S+:\d+', value):
if not re.match(r'\S+:\d+', value):
raise ValueError('Wrong value of server_endpoint, '
'expected <host>:<port>, but got: %s' % value)
return value

View File

@ -28,10 +28,10 @@ class TestSla(testtools.TestCase):
self.assertFalse(sla.eval_expr('(not 11 > 7) or (not 5 < 6)'))
def test_eval_regex(self):
self.assertTrue(sla.eval_expr('"some text" & "\w+\s+\w+"'))
self.assertFalse(sla.eval_expr('"some text" & "\d+"'))
self.assertTrue(sla.eval_expr(r'"some text" & "\w+\s+\w+"'))
self.assertFalse(sla.eval_expr(r'"some text" & "\d+"'))
self.assertFalse(sla.eval_expr('a & "\d+"', {'a': ''}))
self.assertFalse(sla.eval_expr(r'a & "\d+"', {'a': ''}))
def test_eval_non_existent_ref(self):
self.assertRaises(sla.SLAException, sla.eval_expr,

View File

@ -2,14 +2,14 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
# Hacking already pins down pep8, pyflakes and flake8
coverage>=4.0 # Apache-2.0
hacking<1.2.0,>=1.1.0 # Apache-2.0 - should be in sync with diskimage-builder
flake8<4.0.0,>=3.6.0 # MIT - must be in sync with diskimage-builder
mock>=2.0 # BSD
oslotest>=1.10.0 # Apache-2.0
sphinx!=1.6.6,!=1.6.7,<2.0.0;python_version=='2.7' # BSD
sphinx!=1.6.6,!=1.6.7;python_version>='3.4' # BSD
sphinxcontrib-httpdomain # BSD
sphinx_rtd_theme
stestr>=2.0.0 # Apache-2.0
stestr>=2.0.0,<3.0.0;python_version=='2.7' # Apache-2.0
stestr>=2.0.0;python_version>='3.4' # Apache-2.0
testtools>=1.4.0 # MIT

View File

@ -91,9 +91,8 @@ commands = bash tools/svg2png.sh
# E125 continuation line does not distinguish itself from next logical line
# H405 multi line docstring summary not separated with an empty line
# E731 do not assign a lambda expression, use a def
# [H106] Don't put vim configuration in source files
# [H203] Use assertIs(Not)None to check for None
ignore = E125,H405,E731
# W504 line break after binary operator
ignore = E125,H405,E731,W504
show-source = true
builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools,build