@@ -57,7 +57,7 @@ def test_default_settings(app, status, warning):
57
57
app .build ()
58
58
path = app .outdir / '404.html'
59
59
assert path .exists ()
60
- content = open ( path ). read ()
60
+ content = path . read_text ()
61
61
62
62
if sphinx .version_info < (6 , 0 ):
63
63
cssclass = "shortcut "
@@ -97,7 +97,7 @@ def test_context_settings(app, status, warning):
97
97
app .build ()
98
98
path = app .outdir / '404.html'
99
99
assert path .exists ()
100
- content = open ( path ). read ()
100
+ content = path . read_text ()
101
101
102
102
chunks = [
103
103
'<h1>Boo!</h1>' ,
@@ -132,7 +132,7 @@ def test_urls_prefix_setting(app, status, warning):
132
132
path = app .outdir / '404.html'
133
133
assert path .exists ()
134
134
135
- content = open ( path ). read ()
135
+ content = path . read_text ()
136
136
137
137
if sphinx .version_info < (6 , 0 ):
138
138
cssclass = "shortcut "
@@ -170,7 +170,7 @@ def test_urls_prefix_setting_none(app, status, warning):
170
170
path = app .outdir / '404.html'
171
171
assert path .exists ()
172
172
173
- content = open ( path ). read ()
173
+ content = path . read_text ()
174
174
175
175
if sphinx .version_info < (6 , 0 ):
176
176
cssclass = "shortcut "
@@ -213,7 +213,7 @@ def test_template_setting(app, status, warning):
213
213
path = app .outdir / '404.html'
214
214
assert path .exists ()
215
215
216
- content = open ( path ). read ()
216
+ content = path . read_text ()
217
217
218
218
chunks = [
219
219
'Custom title' ,
@@ -237,7 +237,7 @@ def test_custom_404_rst_source(app, status, warning):
237
237
path = app .outdir / '404.html'
238
238
assert path .exists ()
239
239
240
- content = open ( path ). read ()
240
+ content = path . read_text ()
241
241
242
242
chunks = [
243
243
# custom 404.rst file content
@@ -279,7 +279,7 @@ def test_image_on_404_rst_source(app, status, warning):
279
279
path = app .outdir / '404.html'
280
280
assert path .exists ()
281
281
282
- content = open ( path ). read ()
282
+ content = path . read_text ()
283
283
284
284
chunks = [
285
285
# .. image::
@@ -313,7 +313,7 @@ def test_image_looks_like_absolute_url(app, status, warning):
313
313
314
314
path = app .outdir / '404.html'
315
315
assert path .exists ()
316
- content = open ( path ). read ()
316
+ content = path . read_text ()
317
317
318
318
chunks = [
319
319
'<img alt="PATH looking as an URL" src="/en/latest/_images/https.png" />' ,
@@ -327,8 +327,8 @@ def test_image_looks_like_absolute_url(app, status, warning):
327
327
def test_image_absolute_url (app , status , warning ):
328
328
app .build ()
329
329
path = app .outdir / '404.html'
330
- assert path .exists () is True
331
- content = open ( path ). read ()
330
+ assert path .exists ()
331
+ content = path . read_text ()
332
332
333
333
chunks = [
334
334
'<img alt="Read the Docs Logo" src="https://read-the-docs-guidelines.readthedocs-hosted.com/_images/logo-dark.png" />' ,
@@ -347,7 +347,7 @@ def test_urls_for_dirhtml_builder(app, status, warning):
347
347
path = app .outdir / '404' / 'index.html'
348
348
assert path .exists ()
349
349
350
- content = open ( path ). read ()
350
+ content = path . read_text ()
351
351
352
352
chunks = [
353
353
# sidebar URLs
@@ -370,7 +370,7 @@ def test_sphinx_resource_urls(app, status, warning):
370
370
path = app .outdir / '404.html'
371
371
assert path .exists ()
372
372
373
- content = open ( path ). read ()
373
+ content = path . read_text ()
374
374
375
375
chunks = [
376
376
# Sphinx's resources URLs
@@ -398,7 +398,7 @@ def test_toctree_urls_notfound_default(app, status, warning):
398
398
path = app .outdir / '404.html'
399
399
assert path .exists ()
400
400
401
- content = open ( path ). read ()
401
+ content = path . read_text ()
402
402
403
403
chunks = [
404
404
# sidebar URLs
@@ -423,7 +423,7 @@ def test_toctree_links(app, status, warning):
423
423
path = app .outdir / '404.html'
424
424
assert path .exists ()
425
425
426
- content = open ( path ). read ()
426
+ content = path . read_text ()
427
427
428
428
chunks = [
429
429
'<h3>Navigation</h3>' ,
@@ -445,7 +445,7 @@ def test_toctree_links_custom_settings(app, status, warning):
445
445
path = app .outdir / '404.html'
446
446
assert path .exists ()
447
447
448
- content = open ( path ). read ()
448
+ content = path . read_text ()
449
449
450
450
chunks = [
451
451
'<h3>Navigation</h3>' ,
@@ -470,7 +470,7 @@ def test_resources_from_extension(app, status, warning):
470
470
path = app .outdir / '404.html'
471
471
assert path .exists ()
472
472
473
- content = open ( path ). read ()
473
+ content = path . read_text ()
474
474
chunks = [
475
475
'<link rel="stylesheet" type="text/css" href="/en/latest/_static/css_added_by_extension.css" />' ,
476
476
'<link rel="stylesheet" type="text/css" href="/en/latest/_static/css_added_by_extension.css" />' ,
@@ -492,7 +492,7 @@ def test_special_readthedocs_urls(environ, app, status, warning):
492
492
path = app .outdir / '404.html'
493
493
assert path .exists ()
494
494
495
- content = open ( path ). read ()
495
+ content = path . read_text ()
496
496
497
497
chunks = [
498
498
# Link included manually
0 commit comments