forked from bartvdbraak/blender
Fix Cycles test report not closing files properly.
This commit is contained in:
parent
f54f680a26
commit
8289b47e3a
@ -173,13 +173,11 @@ class Report:
|
|||||||
if not os.path.exists(outdir):
|
if not os.path.exists(outdir):
|
||||||
os.makedirs(outdir)
|
os.makedirs(outdir)
|
||||||
|
|
||||||
f = open(os.path.join(outdir, "failed.data"), "w")
|
filepath = os.path.join(outdir, "failed.data")
|
||||||
f.write(self.failed_tests)
|
pathlib.Path(filepath).write_text(self.failed_tests)
|
||||||
f.close()
|
|
||||||
|
|
||||||
f = open(os.path.join(outdir, "passed.data"), "w")
|
filepath = os.path.join(outdir, "passed.data")
|
||||||
f.write(self.passed_tests)
|
pathlib.Path(filepath).write_text(self.passed_tests)
|
||||||
f.close()
|
|
||||||
|
|
||||||
# gather intermediate data for all tests
|
# gather intermediate data for all tests
|
||||||
failed_data = sorted(glob.glob(os.path.join(OUTDIR, "*/failed.data")))
|
failed_data = sorted(glob.glob(os.path.join(OUTDIR, "*/failed.data")))
|
||||||
@ -189,9 +187,11 @@ class Report:
|
|||||||
passed_tests = ""
|
passed_tests = ""
|
||||||
|
|
||||||
for filename in failed_data:
|
for filename in failed_data:
|
||||||
failed_tests += open(os.path.join(OUTDIR, filename), "r").read()
|
filepath = os.path.join(OUTDIR, filename)
|
||||||
|
failed_tests += pathlib.Path(filepath).read_text()
|
||||||
for filename in passed_data:
|
for filename in passed_data:
|
||||||
passed_tests += open(os.path.join(OUTDIR, filename), "r").read()
|
filepath = os.path.join(OUTDIR, filename)
|
||||||
|
passed_tests += pathlib.Path(filepath).read_text()
|
||||||
|
|
||||||
# write html for all tests
|
# write html for all tests
|
||||||
self.html = """
|
self.html = """
|
||||||
@ -241,9 +241,7 @@ class Report:
|
|||||||
""" . format(failed_tests, passed_tests)
|
""" . format(failed_tests, passed_tests)
|
||||||
|
|
||||||
filepath = os.path.join(OUTDIR, "report.html")
|
filepath = os.path.join(OUTDIR, "report.html")
|
||||||
f = open(filepath, "w")
|
pathlib.Path(filepath).write_text(self.html)
|
||||||
f.write(self.html)
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
print_message("Report saved to: " + pathlib.Path(filepath).as_uri())
|
print_message("Report saved to: " + pathlib.Path(filepath).as_uri())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user