Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tests): resource warnings about unclosed file #232

Merged
merged 2 commits into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions tests/test_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_default_settings(app, status, warning):
app.build()
path = app.outdir / '404.html'
assert path.exists()
content = open(path).read()
content = path.read_text()

if sphinx.version_info < (6, 0):
cssclass = "shortcut "
Expand Down Expand Up @@ -97,7 +97,7 @@ def test_context_settings(app, status, warning):
app.build()
path = app.outdir / '404.html'
assert path.exists()
content = open(path).read()
content = path.read_text()

chunks = [
'<h1>Boo!</h1>',
Expand Down Expand Up @@ -132,7 +132,7 @@ def test_urls_prefix_setting(app, status, warning):
path = app.outdir / '404.html'
assert path.exists()

content = open(path).read()
content = path.read_text()

if sphinx.version_info < (6, 0):
cssclass = "shortcut "
Expand Down Expand Up @@ -170,7 +170,7 @@ def test_urls_prefix_setting_none(app, status, warning):
path = app.outdir / '404.html'
assert path.exists()

content = open(path).read()
content = path.read_text()

if sphinx.version_info < (6, 0):
cssclass = "shortcut "
Expand Down Expand Up @@ -213,7 +213,7 @@ def test_template_setting(app, status, warning):
path = app.outdir / '404.html'
assert path.exists()

content = open(path).read()
content = path.read_text()

chunks = [
'Custom title',
Expand All @@ -237,7 +237,7 @@ def test_custom_404_rst_source(app, status, warning):
path = app.outdir / '404.html'
assert path.exists()

content = open(path).read()
content = path.read_text()

chunks = [
# custom 404.rst file content
Expand Down Expand Up @@ -279,7 +279,7 @@ def test_image_on_404_rst_source(app, status, warning):
path = app.outdir / '404.html'
assert path.exists()

content = open(path).read()
content = path.read_text()

chunks = [
# .. image::
Expand Down Expand Up @@ -313,7 +313,7 @@ def test_image_looks_like_absolute_url(app, status, warning):

path = app.outdir / '404.html'
assert path.exists()
content = open(path).read()
content = path.read_text()

chunks = [
'<img alt="PATH looking as an URL" src="/en/latest/_images/https.png" />',
Expand All @@ -327,8 +327,8 @@ def test_image_looks_like_absolute_url(app, status, warning):
def test_image_absolute_url(app, status, warning):
app.build()
path = app.outdir / '404.html'
assert path.exists() is True
content = open(path).read()
assert path.exists()
content = path.read_text()

chunks = [
'<img alt="Read the Docs Logo" src="https://read-the-docs-guidelines.readthedocs-hosted.com/_images/logo-dark.png" />',
Expand All @@ -347,7 +347,7 @@ def test_urls_for_dirhtml_builder(app, status, warning):
path = app.outdir / '404' / 'index.html'
assert path.exists()

content = open(path).read()
content = path.read_text()

chunks = [
# sidebar URLs
Expand All @@ -370,7 +370,7 @@ def test_sphinx_resource_urls(app, status, warning):
path = app.outdir / '404.html'
assert path.exists()

content = open(path).read()
content = path.read_text()

chunks = [
# Sphinx's resources URLs
Expand Down Expand Up @@ -398,7 +398,7 @@ def test_toctree_urls_notfound_default(app, status, warning):
path = app.outdir / '404.html'
assert path.exists()

content = open(path).read()
content = path.read_text()

chunks = [
# sidebar URLs
Expand All @@ -423,7 +423,7 @@ def test_toctree_links(app, status, warning):
path = app.outdir / '404.html'
assert path.exists()

content = open(path).read()
content = path.read_text()

chunks = [
'<h3>Navigation</h3>',
Expand All @@ -445,7 +445,7 @@ def test_toctree_links_custom_settings(app, status, warning):
path = app.outdir / '404.html'
assert path.exists()

content = open(path).read()
content = path.read_text()

chunks = [
'<h3>Navigation</h3>',
Expand All @@ -470,7 +470,7 @@ def test_resources_from_extension(app, status, warning):
path = app.outdir / '404.html'
assert path.exists()

content = open(path).read()
content = path.read_text()
chunks = [
'<link rel="stylesheet" type="text/css" href="/en/latest/_static/css_added_by_extension.css" />',
'<link rel="stylesheet" type="text/css" href="/en/latest/_static/css_added_by_extension.css" />',
Expand All @@ -492,7 +492,7 @@ def test_special_readthedocs_urls(environ, app, status, warning):
path = app.outdir / '404.html'
assert path.exists()

content = open(path).read()
content = path.read_text()

chunks = [
# Link included manually
Expand Down