Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2017-09-20 20:12:26 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2017-09-20 20:12:26 +0300
commit8289b47e3a425207a2b1fb8e47b7002e90444ce2 (patch)
tree318af027e4e2aaa51c94bda469b16d1839470198 /tests
parentf54f680a2681fbb3aebee51886f123106ee8ef51 (diff)
Fix Cycles test report not closing files properly.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/python/cycles_render_tests.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/tests/python/cycles_render_tests.py b/tests/python/cycles_render_tests.py
index fde0b6bdcba..2122150467c 100755
--- a/tests/python/cycles_render_tests.py
+++ b/tests/python/cycles_render_tests.py
@@ -173,13 +173,11 @@ class Report:
if not os.path.exists(outdir):
os.makedirs(outdir)
- f = open(os.path.join(outdir, "failed.data"), "w")
- f.write(self.failed_tests)
- f.close()
+ filepath = os.path.join(outdir, "failed.data")
+ pathlib.Path(filepath).write_text(self.failed_tests)
- f = open(os.path.join(outdir, "passed.data"), "w")
- f.write(self.passed_tests)
- f.close()
+ filepath = os.path.join(outdir, "passed.data")
+ pathlib.Path(filepath).write_text(self.passed_tests)
# gather intermediate data for all tests
failed_data = sorted(glob.glob(os.path.join(OUTDIR, "*/failed.data")))
@@ -189,9 +187,11 @@ class Report:
passed_tests = ""
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:
- 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
self.html = """
@@ -241,9 +241,7 @@ class Report:
""" . format(failed_tests, passed_tests)
filepath = os.path.join(OUTDIR, "report.html")
- f = open(filepath, "w")
- f.write(self.html)
- f.close()
+ pathlib.Path(filepath).write_text(self.html)
print_message("Report saved to: " + pathlib.Path(filepath).as_uri())