diff --git a/tests/roots/test-util-copyasset_overwrite/myext.py b/tests/roots/test-util-copyasset_overwrite/myext.py index 3f961fb8758..6c2ad23395b 100644 --- a/tests/roots/test-util-copyasset_overwrite/myext.py +++ b/tests/roots/test-util-copyasset_overwrite/myext.py @@ -6,14 +6,14 @@ def _copy_asset_overwrite_hook(app): css = app.outdir / '_static' / 'custom-styles.css' # html_static_path is copied by default - assert css.read_text() == '/* html_static_path */\n', 'invalid default text' + assert css.read_text(encoding='utf-8') == '/* html_static_path */\n', 'invalid default text' # warning generated by here copy_asset( Path(__file__).parent.joinpath('myext_static', 'custom-styles.css'), app.outdir / '_static', ) # This demonstrates that no overwriting occurs - assert css.read_text() == '/* html_static_path */\n', 'file overwritten!' + assert css.read_text(encoding='utf-8') == '/* html_static_path */\n', 'file overwritten!' return [] diff --git a/tests/test_builders/test_build_linkcheck.py b/tests/test_builders/test_build_linkcheck.py index cd36981f74f..8a132ec0656 100644 --- a/tests/test_builders/test_build_linkcheck.py +++ b/tests/test_builders/test_build_linkcheck.py @@ -240,6 +240,7 @@ def test_raw_node(app: SphinxTestApp) -> None: index.write_text( ".. raw:: 'html'\n" " :url: http://{address}/".format(address=address), + encoding='utf-8', ) app.build() diff --git a/tests/test_extensions/test_ext_autosummary.py b/tests/test_extensions/test_ext_autosummary.py index bdce719e72e..2f8bb946713 100644 --- a/tests/test_extensions/test_ext_autosummary.py +++ b/tests/test_extensions/test_ext_autosummary.py @@ -696,7 +696,7 @@ def test_autogen(rootdir, tmp_path): def test_autogen_remove_old(rootdir, tmp_path): """Test the ``--remove-old`` option.""" - tmp_path.joinpath('other.rst').write_text('old content') + tmp_path.joinpath('other.rst').write_text('old content', encoding='utf-8') with chdir(rootdir / 'test-templating'): args = ['-o', str(tmp_path), '-t', '.', 'autosummary_templating.txt'] autogen_main(args)