Skip to content

Commit

Permalink
Refactor file opening to use 'with' statement
Browse files Browse the repository at this point in the history
  • Loading branch information
SaillantNicolas committed Jun 12, 2024
1 parent 3aa8e3a commit b2e6a4a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Testsuite/test/post_process_ctest_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ def find_last_separator(inner_contents):
if not os.path.isdir(name):
is_ignored = True
os.mkdir(name)
report_file_handle=open("{dir}/{file}".format(dir=name, file=report_file_name), "w+", encoding="utf-8")
report_file_handle.write(open("{}/../../../../../.scm-branch".format(os.getcwd()), 'r', encoding="utf-8").read())
with open("{dir}/{file}".format(dir=name, file=report_file_name), "w+", encoding="utf-8") as report_file_handle:
report_file_handle.write(open("{}/../../../../../.scm-branch".format(os.getcwd()), 'r', encoding="utf-8").read())
else:
is_ignored = False
file_path = "{dir}/{file}".format(dir=name, file=report_file_name)
Expand Down

0 comments on commit b2e6a4a

Please sign in to comment.