diff --git a/tests/test_build_dirhtml.py b/tests/test_build_dirhtml.py
index 715db1146..6e2cdb0cb 100644
--- a/tests/test_build_dirhtml.py
+++ b/tests/test_build_dirhtml.py
@@ -25,7 +25,7 @@ def test_dirhtml(app, status, warning):
assert (app.outdir / 'foo/foo_2/index.html').exists()
assert (app.outdir / 'bar/index.html').exists()
- content = (app.outdir / 'index.html').text()
+ content = (app.outdir / 'index.html').read_text()
assert 'href="foo/"' in content
assert 'href="foo/foo_1/"' in content
assert 'href="foo/foo_2/"' in content
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py
index f78c1e9d8..98736dae9 100644
--- a/tests/test_domain_py.py
+++ b/tests/test_domain_py.py
@@ -168,7 +168,7 @@ def test_domain_py_objects(app, status, warning):
def test_resolve_xref_for_properties(app, status, warning):
app.builder.build_all()
- content = (app.outdir / 'module.html').text()
+ content = (app.outdir / 'module.html').read_text()
assert ('Link to '
''