summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-02-16 20:44:38 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-02-16 20:44:38 +0900
commit0e2e31a6121d3b139e710a3622e34942cd5123bb (patch)
tree0f25c51359c22a1d5b5ee0a87388b042e337ade8
parentccd7381d388fb84bdaf6f25cf69d2306a500961a (diff)
downloadsphinx-git-0e2e31a6121d3b139e710a3622e34942cd5123bb.tar.gz
test: Fix ResourceWarning
-rw-r--r--tests/test_build_dirhtml.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/test_build_dirhtml.py b/tests/test_build_dirhtml.py
index 6e2cdb0cb..e89e6888d 100644
--- a/tests/test_build_dirhtml.py
+++ b/tests/test_build_dirhtml.py
@@ -32,8 +32,9 @@ def test_dirhtml(app, status, warning):
assert 'href="bar/"' in content
# objects.inv (refs: #7095)
- f = (app.outdir / 'objects.inv').open('rb')
- invdata = InventoryFile.load(f, 'path/to', posixpath.join)
+ with (app.outdir / 'objects.inv').open('rb') as f:
+ invdata = InventoryFile.load(f, 'path/to', posixpath.join)
+
assert 'index' in invdata.get('std:doc')
assert ('Python', '', 'path/to/', '-') == invdata['std:doc']['index']