Skip to content

Commit

Permalink
Specify encoding to avoid EncodingWarning
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Jul 29, 2024
1 parent b0485f9 commit a4102a7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tests/roots/test-util-copyasset_overwrite/myext.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 []


Expand Down
1 change: 1 addition & 0 deletions tests/test_builders/test_build_linkcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion tests/test_extensions/test_ext_autosummary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a4102a7

Please sign in to comment.