c8138d4fa5
We're starting to accumulate a number of python scripts in various parts of the tree, and probably will continue to do so. To make maintenance easier over time, we should have basic pep8/flake8 checks in place for python code, as is best practice elsewhere in the OpenStack project. This patch adds basic checks and corrects existing errors in our python scripts so that going forward we can opt to gate on clean python code. Change-Id: Ie32ee7a14ee608e12f42288e137a0849555b5ed8
57 lines
1.5 KiB
Python
57 lines
1.5 KiB
Python
import json
|
|
|
|
capabilities_file = open('../2015.05.json', 'r')
|
|
defcore = json.loads(capabilities_file.read())
|
|
capabilities = defcore['capabilities']
|
|
required_tests = []
|
|
flagged_tests = []
|
|
|
|
required_tests_file = open('2015.05.required.txt', 'w')
|
|
flagged_tests_file = open('2015.05.flagged.txt', 'w')
|
|
|
|
for capability_name in capabilities:
|
|
capability = capabilities[capability_name]
|
|
if capability['status'] == 'required':
|
|
tests = capability['tests']
|
|
for test in tests:
|
|
required_tests.append(test)
|
|
flagged = capability['flagged']
|
|
for test in flagged:
|
|
flagged_tests.append(test)
|
|
|
|
required_tests.sort()
|
|
|
|
alltests = []
|
|
for line in open('7c8fcc67-api-test-list.txt'):
|
|
alltests.append(line.rstrip())
|
|
|
|
alltests.sort()
|
|
|
|
# n^2, terrible
|
|
for rtest in required_tests:
|
|
testmatch = rtest + '['
|
|
found = False
|
|
for test in alltests:
|
|
if test.startswith(testmatch):
|
|
required_tests_file.write(test + '\n')
|
|
print test
|
|
found = True
|
|
if not found:
|
|
print "!!! Did not find test matching " % (rtest)
|
|
|
|
print "\nflagged\n======="
|
|
|
|
for flagged in flagged_tests:
|
|
testmatch = flagged + '['
|
|
found = False
|
|
for test in alltests:
|
|
if test.startswith(testmatch):
|
|
flagged_tests_file.write(test + '\n')
|
|
print test
|
|
found = True
|
|
if not found:
|
|
print "!!! Did not find flagged test matching " % (flagged)
|
|
|
|
required_tests_file.close()
|
|
flagged_tests_file.close()
|