Skip to content

Commit

Permalink
Merge pull request #7082 from tk0miya/refactor_read_text
Browse files Browse the repository at this point in the history
test: encoding="utf-8" is no longer needed on reading text
  • Loading branch information
tk0miya committed Feb 1, 2020
2 parents 0c0d037 + bdd08b1 commit 46897c2
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 94 deletions.
18 changes: 9 additions & 9 deletions tests/test_build_html.py
Expand Up @@ -1293,7 +1293,7 @@ def test_html_anchor_for_figure(app):
@pytest.mark.sphinx('html', testroot='directives-raw')
def test_html_raw_directive(app, status, warning):
app.builder.build_all()
result = (app.outdir / 'index.html').read_text(encoding='utf8')
result = (app.outdir / 'index.html').read_text()

# standard case
assert 'standalone raw directive (HTML)' in result
Expand Down Expand Up @@ -1347,7 +1347,7 @@ def test_html_style(app, status, warning):
def test_html_remote_images(app, status, warning):
app.builder.build_all()

result = (app.outdir / 'index.html').read_text(encoding='utf8')
result = (app.outdir / 'index.html').read_text()
assert ('<img alt="https://www.python.org/static/img/python-logo.png" '
'src="https://www.python.org/static/img/python-logo.png" />' in result)
assert not (app.outdir / 'python-logo.png').exists()
Expand All @@ -1359,7 +1359,7 @@ def test_html_sidebar(app, status, warning):

# default for alabaster
app.builder.build_all()
result = (app.outdir / 'index.html').read_text(encoding='utf8')
result = (app.outdir / 'index.html').read_text()
assert ('<div class="sphinxsidebar" role="navigation" '
'aria-label="main navigation">' in result)
assert '<h1 class="logo"><a href="#">Python</a></h1>' in result
Expand All @@ -1374,7 +1374,7 @@ def test_html_sidebar(app, status, warning):
# only relations.html
app.config.html_sidebars = {'**': ['relations.html']}
app.builder.build_all()
result = (app.outdir / 'index.html').read_text(encoding='utf8')
result = (app.outdir / 'index.html').read_text()
assert ('<div class="sphinxsidebar" role="navigation" '
'aria-label="main navigation">' in result)
assert '<h1 class="logo"><a href="#">Python</a></h1>' not in result
Expand All @@ -1388,7 +1388,7 @@ def test_html_sidebar(app, status, warning):
# no sidebars
app.config.html_sidebars = {'**': []}
app.builder.build_all()
result = (app.outdir / 'index.html').read_text(encoding='utf8')
result = (app.outdir / 'index.html').read_text()
assert ('<div class="sphinxsidebar" role="navigation" '
'aria-label="main navigation">' not in result)
assert '<h1 class="logo"><a href="#">Python</a></h1>' not in result
Expand Down Expand Up @@ -1419,10 +1419,10 @@ def test_html_manpage(app, cached_etree_parse, fname, expect):
def test_html_baseurl(app, status, warning):
app.build()

result = (app.outdir / 'index.html').read_text(encoding='utf8')
result = (app.outdir / 'index.html').read_text()
assert '<link rel="canonical" href="https://example.com/index.html" />' in result

result = (app.outdir / 'qux' / 'index.html').read_text(encoding='utf8')
result = (app.outdir / 'qux' / 'index.html').read_text()
assert '<link rel="canonical" href="https://example.com/qux/index.html" />' in result


Expand All @@ -1432,10 +1432,10 @@ def test_html_baseurl(app, status, warning):
def test_html_baseurl_and_html_file_suffix(app, status, warning):
app.build()

result = (app.outdir / 'index.htm').read_text(encoding='utf8')
result = (app.outdir / 'index.htm').read_text()
assert '<link rel="canonical" href="https://example.com/subdir/index.htm" />' in result

result = (app.outdir / 'qux' / 'index.htm').read_text(encoding='utf8')
result = (app.outdir / 'qux' / 'index.htm').read_text()
assert '<link rel="canonical" href="https://example.com/subdir/qux/index.htm" />' in result


Expand Down

0 comments on commit 46897c2

Please sign in to comment.