Skip to content

Commit a4102a7

Browse files
committed
Specify encoding to avoid EncodingWarning
1 parent b0485f9 commit a4102a7

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

tests/roots/test-util-copyasset_overwrite/myext.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
def _copy_asset_overwrite_hook(app):
77
css = app.outdir / '_static' / 'custom-styles.css'
88
# html_static_path is copied by default
9-
assert css.read_text() == '/* html_static_path */\n', 'invalid default text'
9+
assert css.read_text(encoding='utf-8') == '/* html_static_path */\n', 'invalid default text'
1010
# warning generated by here
1111
copy_asset(
1212
Path(__file__).parent.joinpath('myext_static', 'custom-styles.css'),
1313
app.outdir / '_static',
1414
)
1515
# This demonstrates that no overwriting occurs
16-
assert css.read_text() == '/* html_static_path */\n', 'file overwritten!'
16+
assert css.read_text(encoding='utf-8') == '/* html_static_path */\n', 'file overwritten!'
1717
return []
1818

1919

tests/test_builders/test_build_linkcheck.py

+1
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ def test_raw_node(app: SphinxTestApp) -> None:
240240
index.write_text(
241241
".. raw:: 'html'\n"
242242
" :url: http://{address}/".format(address=address),
243+
encoding='utf-8',
243244
)
244245
app.build()
245246

tests/test_extensions/test_ext_autosummary.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ def test_autogen(rootdir, tmp_path):
696696

697697
def test_autogen_remove_old(rootdir, tmp_path):
698698
"""Test the ``--remove-old`` option."""
699-
tmp_path.joinpath('other.rst').write_text('old content')
699+
tmp_path.joinpath('other.rst').write_text('old content', encoding='utf-8')
700700
with chdir(rootdir / 'test-templating'):
701701
args = ['-o', str(tmp_path), '-t', '.', 'autosummary_templating.txt']
702702
autogen_main(args)

0 commit comments

Comments
 (0)