2525 [r .name for r in Path ("tests/data" ).glob ("*.rst" )],
2626)
2727def test_summarize_html (rst_file : str ) -> None :
28- rst = (PROJECT / "tests/data" / rst_file ).read_text ()
28+ rst = (PROJECT / "tests/data" / rst_file ).read_text (encoding = "utf-8" )
2929 root = rst_file .removesuffix (".rst" )
3030 with in_tempdir ():
3131 doctree = run_sphinx (rst , buildername = "html" , extensions = ["linklint.ext" ])
@@ -34,19 +34,21 @@ def test_summarize_html(rst_file: str) -> None:
3434 # In case of needing to see what happened, copy the HTML etc to tmp.
3535 shutil .copytree ("_build/_static" , PROJECT / "tmp/html/_static" , dirs_exist_ok = True )
3636 shutil .copyfile ("_build/index.html" , PROJECT / f"tmp/html/{ root } .html" )
37- (PROJECT / f"tmp/html/{ root } _summary.html" ).write_text (summary )
37+ (PROJECT / f"tmp/html/{ root } _summary.html" ).write_text (summary , encoding = "utf-8" )
3838
3939 # Also run without the extension to understand Sphinx native behavior.
4040 run_sphinx (rst , buildername = "html" , extensions = [])
4141 shutil .copyfile ("_build/index.html" , PROJECT / f"tmp/html/{ root } _nofix.html" )
4242 nofix_summary = summarize_html_file ("_build/index.html" )
43- (PROJECT / f"tmp/html/{ root } _summary_nofix.html" ).write_text (nofix_summary )
43+ (PROJECT / f"tmp/html/{ root } _summary_nofix.html" ).write_text (
44+ nofix_summary , encoding = "utf-8"
45+ )
4446
4547 save_test_doctree (doctree )
4648 assert 'class="self-link"' not in summary , f"Self-links found in { root } .html"
4749 summary_file = PROJECT / f"tests/data/{ root } _summary.html"
4850 if summary_file .exists ():
49- expected = summary_file .read_text ()
51+ expected = summary_file .read_text (encoding = "utf-8" )
5052 else :
5153 expected = f"Summary { summary_file } doesn't exist" # pragma: only failure
5254
0 commit comments