X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=tests%2Fcoverage_dungeon.py;h=bbab99bcfe841b828b74d19a9efcc2d4b56bc81d;hb=60d70705063266ed23b1e86d11145770087f660f;hp=8bb1c4698157836f92f3fdb692c52abb252aede0;hpb=a44ec197536b1cd9d33e54d9a1f9803f5bda6387;p=open-adventure.git diff --git a/tests/coverage_dungeon.py b/tests/coverage_dungeon.py index 8bb1c46..bbab99b 100755 --- a/tests/coverage_dungeon.py +++ b/tests/coverage_dungeon.py @@ -12,6 +12,8 @@ even if the checkfile search doesn't find them. Typically this will because they emit a templated message that can't be regression-tested by equality. """ +# pylint: disable=consider-using-f-string + import os import sys import re @@ -197,7 +199,7 @@ def coverage_report(db, check_file_contents): if __name__ == "__main__": # load DB try: - with open(YAML_PATH, "r") as f: + with open(YAML_PATH, "r", encoding='ascii', errors='surrogateescape') as f: db = yaml.safe_load(f) except IOError as e: print('ERROR: could not load %s (%s)' % (YAML_PATH, e.strerror)) @@ -207,7 +209,7 @@ if __name__ == "__main__": check_file_contents = [] for filename in os.listdir(TEST_DIR): if filename.endswith(".chk"): - with open(filename, "r") as f: + with open(filename, "r", encoding='ascii', errors='surrogateescape') as f: check_file_contents.append(f.read()) # run coverage analysis report on dungeon database @@ -254,7 +256,7 @@ if __name__ == "__main__": # render HTML report try: - with open(HTML_TEMPLATE_PATH, "r") as f: + with open(HTML_TEMPLATE_PATH, "r", encoding='ascii', errors='surrogateescape') as f: # read in HTML template html_template = f.read() except IOError as e: @@ -263,7 +265,7 @@ if __name__ == "__main__": # parse template with report and write it out try: - with open(html_output_path, "w") as f: + with open(html_output_path, "w", encoding='ascii', errors='surrogateescape') as f: f.write(html_template.format(categories=categories_html, summary=summary_html)) except IOError as e: print('ERROR: writing HTML report failed ({})'.format(e.strerror))