Fixed flake8 and broken gate

Flake8 went broken recently, adopts correct calling method to avoid
regression and fixes broken rules.

Also removes openstack-tox-pep8 from gate which was a guaranteed
failure when triggered as pep8 was removed.

Change-Id: Iba03d3051952f461bb16299a6d32475b2be43041
This commit is contained in:
Sorin Sbarnea 2020-01-27 14:06:28 +00:00
parent 612dfbd118
commit b6611fd03a
6 changed files with 45 additions and 37 deletions

View File

@ -10,9 +10,12 @@ repos:
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: debug-statements
- id: flake8
- id: check-yaml
files: .*\.(yaml|yml)$
- repo: https://gitlab.com/pycqa/flake8
rev: '3.7.9'
hooks:
- id: flake8
# commented to allow progressive adoption in smaller patches
# - repo: https://github.com/adrienverge/yamllint.git
# rev: v1.18.0

View File

@ -337,28 +337,32 @@ if __name__ == '__main__':
default_output_file = '{}.out'.format(os.path.basename(__file__))
parser = argparse.ArgumentParser(
formatter_class=argparse.RawTextHelpFormatter,
description='Get a dictionary of releases from a release '
'and a featureset file.')
parser.add_argument('--stable-release',
choices=RELEASES,
required=True,
help='Release that the change being tested is from.\n'
'All other releases are calculated from this\n'
'basis.')
parser.add_argument('--featureset-file',
required=True,
help='Featureset file which will be introspected to\n'
'infer what type of upgrade is being performed\n'
'(if any).')
parser.add_argument('--output-file', default=default_output_file,
help='Output file containing dictionary of releases\n'
'for the provided featureset and release.\n'
'(default: %(default)s)')
parser.add_argument('--log-file', default=default_log_file,
help='log file to print debug information from\n'
'running the script.\n'
'(default: %(default)s)')
formatter_class=argparse.RawTextHelpFormatter,
description='Get a dictionary of releases from a release '
'and a featureset file.')
parser.add_argument(
'--stable-release',
choices=RELEASES,
required=True,
help='Release that the change being tested is from.\n'
'All other releases are calculated from this\n'
'basis.')
parser.add_argument(
'--featureset-file',
required=True,
help='Featureset file which will be introspected to\n'
'infer what type of upgrade is being performed\n'
'(if any).')
parser.add_argument(
'--output-file', default=default_output_file,
help='Output file containing dictionary of releases\n'
'for the provided featureset and release.\n'
'(default: %(default)s)')
parser.add_argument(
'--log-file', default=default_log_file,
help='log file to print debug information from\n'
'running the script.\n'
'(default: %(default)s)')
parser.add_argument('--upgrade-from', action='store_false',
help='Upgrade FROM the change under test instead\n'
'of the default of upgrading TO the change\n'

View File

@ -173,9 +173,9 @@ def gen_html(data, html_file, table_file, stats_hours, job_names, options):
fp.write("</tr>")
fp.write("<table>")
fp.write("<p>Query parameters:</p>")
fp.write("Branch: "+options.b+"<br/>")
fp.write("Status: "+options.s+"<br/>")
fp.write("Limit: "+options.l)
fp.write("Branch: " + options.b + "<br/>")
fp.write("Status: " + options.s + "<br/>")
fp.write("Limit: " + options.l)
total = passed_jobs + partial_jobs + failed_jobs
fp.write("<p>Overall</p>")
@ -183,17 +183,17 @@ def gen_html(data, html_file, table_file, stats_hours, job_names, options):
passed_jobs,
total,
float(passed_jobs) / float(total) * 100
))
))
fp.write("Partial Failures: %d/%d (%d %%)<br/>" % (
partial_jobs,
total,
float(partial_jobs) / float(total) * 100
))
))
fp.write("Complete Failures: %d/%d (%d %%)<br/>" % (
failed_jobs,
total,
float(failed_jobs) / float(total) * 100
))
))
fp.close()
@ -244,9 +244,8 @@ def main(args=sys.argv[1:]):
'patchset': patchset,
'project': re.sub(r'.*/', '', review['project']),
'branch': review['branch'],
})
results[key].setdefault(
'ci_results', {}).update(ci_results)
})
results[key].setdefault('ci_results', {}).update(ci_results)
gen_html(results, opts.o, "%s-table" % opts.o, 24, job_names, opts)

View File

@ -33,3 +33,8 @@ warnerrors = False
[tool:pytest]
norecursedirs = .git .tox dist
log_cli = true
[flake8]
# based on https://github.com/psf/black
ignore = E203,E501,W503,W504,D
# "D" added because we do not use docstrings checks, yet

View File

@ -146,7 +146,7 @@ def main(args=sys.argv[1:]):
'connect to.')
parser.add_argument('--jobnum', '-n', default=uuid.uuid4().hex,
help='A unique identifier identifing this job.')
parser.add_argument('--timeout', '-t', default='10800',
parser.add_argument('--timeout', '-t', default='10800',
help='Set a timeout, after which the command will '
'be killed.')
parser.add_argument('--envsize', default="2",
@ -177,7 +177,7 @@ def main(args=sys.argv[1:]):
parser.add_argument('--extra-nodes', default='0',
help='Number of extra undercloud-like nodes to '
'request')
parser.add_argument('--debug', '-d', action='store_true',
parser.add_argument('--debug', '-d', action='store_true',
help='Set to debug mode.')
opts = parser.parse_args(args)
if opts.debug:

View File

@ -71,9 +71,6 @@
- openstack-tox-py35:
files:
- ^scripts/emit_releases_file/.*$
- openstack-tox-pep8:
files:
- ^scripts/emit_releases_file/.*$
- tripleo-buildimage-overcloud-full-centos-7:
files: *build_images_files
- tripleo-ci-centos-7-standalone-upgrade-train: