Cleanup: pep8

This commit is contained in:
Campbell Barton
2018-07-03 06:47:49 +02:00
parent b66aa0b0a6
commit 8c15d612a5
31 changed files with 593 additions and 485 deletions

View File

@@ -23,6 +23,7 @@ class COLORS_DUMMY:
GREEN = ''
ENDC = ''
COLORS = COLORS_DUMMY
@@ -55,10 +56,12 @@ def blend_list(dirpath):
filepath = os.path.join(dirpath, filename)
yield filepath
def test_get_name(filepath):
filename = os.path.basename(filepath)
return os.path.splitext(filename)[0]
def test_get_images(output_dir, filepath):
testname = test_get_name(filepath)
dirpath = os.path.dirname(filepath)
@@ -96,7 +99,7 @@ class Report:
'update',
'failed_tests',
'passed_tests'
)
)
def __init__(self, title, output_dir, idiff):
self.title = title
@@ -257,7 +260,6 @@ class Report:
else:
self.passed_tests += test_html
def _diff_output(self, filepath, tmp_filepath):
old_img, ref_img, new_img, diff_img = test_get_images(self.output_dir, filepath)
@@ -280,7 +282,7 @@ class Report:
"-failpercent", "1",
ref_img,
tmp_filepath,
)
)
try:
subprocess.check_output(command)
failed = False
@@ -307,7 +309,7 @@ class Report:
"-abs", "-scale", "16",
ref_img,
tmp_filepath
)
)
try:
subprocess.check_output(command)
@@ -317,7 +319,6 @@ class Report:
return not failed
def _run_test(self, filepath, render_cb):
testname = test_get_name(filepath)
print_message(testname, 'SUCCESS', 'RUN')
@@ -344,7 +345,7 @@ class Report:
return error
elif error == "NO_START":
print_message('Can not perform tests because blender fails to start.',
'Make sure INSTALL target was run.')
'Make sure INSTALL target was run.')
return error
elif error == 'VERIFY':
print_message("Rendered result is different from reference image")
@@ -354,7 +355,6 @@ class Report:
'FAILURE', 'FAILED')
return error
def _run_all_tests(self, dirname, dirpath, render_cb):
passed_tests = []
failed_tests = []
@@ -387,8 +387,8 @@ class Report:
'SUCCESS', 'PASSED')
if failed_tests:
print_message("{} tests, listed below:" .
format(len(failed_tests)),
'FAILURE', 'FAILED')
format(len(failed_tests)),
'FAILURE', 'FAILED')
failed_tests.sort()
for test in failed_tests:
print_message("{}" . format(test), 'FAILURE', "FAILED")