summaryrefslogtreecommitdiff
path: root/tests/test_ext_viewcode.py
diff options
context:
space:
mode:
authorAdam Turner <9087854+aa-turner@users.noreply.github.com>2022-04-27 03:04:19 +0100
committerAdam Turner <9087854+aa-turner@users.noreply.github.com>2022-04-27 03:04:19 +0100
commit24e3b7c8c8c0a2d01ec2d2d4d04105bcb565e440 (patch)
tree72862fd42abc102ff99ac35687d4cc7af17b0c2d /tests/test_ext_viewcode.py
parent8866adeacfb045c97302cc9c7e3b60dec5ca38fd (diff)
downloadsphinx-git-24e3b7c8c8c0a2d01ec2d2d4d04105bcb565e440.tar.gz
`.read_text()` -> `.read_text(encoding='utf8')`
Diffstat (limited to 'tests/test_ext_viewcode.py')
-rw-r--r--tests/test_ext_viewcode.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/test_ext_viewcode.py b/tests/test_ext_viewcode.py
index c2e195428..7750b8da0 100644
--- a/tests/test_ext_viewcode.py
+++ b/tests/test_ext_viewcode.py
@@ -16,7 +16,7 @@ def test_viewcode(app, status, warning):
warnings
)
- result = (app.outdir / 'index.html').read_text()
+ result = (app.outdir / 'index.html').read_text(encoding='utf8')
assert result.count('href="_modules/spam/mod1.html#func1"') == 2
assert result.count('href="_modules/spam/mod2.html#func2"') == 2
assert result.count('href="_modules/spam/mod1.html#Class1"') == 2
@@ -29,7 +29,7 @@ def test_viewcode(app, status, warning):
# the next assert fails, until the autodoc bug gets fixed
assert result.count('this is the class attribute class_attr') == 2
- result = (app.outdir / '_modules/spam/mod1.html').read_text()
+ result = (app.outdir / '_modules/spam/mod1.html').read_text(encoding='utf8')
result = re.sub('<span class=".*?">', '<span>', result) # filter pygments classes
assert ('<div class="viewcode-block" id="Class1"><a class="viewcode-back" '
'href="../../index.html#spam.Class1">[docs]</a>'
@@ -47,7 +47,7 @@ def test_viewcode_epub_default(app, status, warning):
assert not (app.outdir / '_modules/spam/mod1.xhtml').exists()
- result = (app.outdir / 'index.xhtml').read_text()
+ result = (app.outdir / 'index.xhtml').read_text(encoding='utf8')
assert result.count('href="_modules/spam/mod1.xhtml#func1"') == 0
@@ -58,7 +58,7 @@ def test_viewcode_epub_enabled(app, status, warning):
assert (app.outdir / '_modules/spam/mod1.xhtml').exists()
- result = (app.outdir / 'index.xhtml').read_text()
+ result = (app.outdir / 'index.xhtml').read_text(encoding='utf8')
assert result.count('href="_modules/spam/mod1.xhtml#func1"') == 2
@@ -66,7 +66,7 @@ def test_viewcode_epub_enabled(app, status, warning):
def test_linkcode(app, status, warning):
app.builder.build(['objects'])
- stuff = (app.outdir / 'objects.html').read_text()
+ stuff = (app.outdir / 'objects.html').read_text(encoding='utf8')
assert 'http://foobar/source/foolib.py' in stuff
assert 'http://foobar/js/' in stuff
@@ -78,7 +78,7 @@ def test_linkcode(app, status, warning):
def test_local_source_files(app, status, warning):
def find_source(app, modname):
if modname == 'not_a_package':
- source = (app.srcdir / 'not_a_package/__init__.py').read_text()
+ source = (app.srcdir / 'not_a_package/__init__.py').read_text(encoding='utf8')
tags = {
'func1': ('def', 1, 1),
'Class1': ('class', 1, 1),
@@ -86,7 +86,7 @@ def test_local_source_files(app, status, warning):
'not_a_package.submodule.Class1': ('class', 1, 1),
}
else:
- source = (app.srcdir / 'not_a_package/submodule.py').read_text()
+ source = (app.srcdir / 'not_a_package/submodule.py').read_text(encoding='utf8')
tags = {
'not_a_package.submodule.func1': ('def', 11, 15),
'Class1': ('class', 19, 22),
@@ -106,7 +106,7 @@ def test_local_source_files(app, status, warning):
warnings
)
- result = (app.outdir / 'index.html').read_text()
+ result = (app.outdir / 'index.html').read_text(encoding='utf8')
assert result.count('href="_modules/not_a_package.html#func1"') == 1
assert result.count('href="_modules/not_a_package.html#not_a_package.submodule.func1"') == 1
assert result.count('href="_modules/not_a_package/submodule.html#Class1"') == 1