Deprecate `md5 and sha1 wrappers in sphinx.util` (#11512)

This commit is contained in:
Adam Turner
2023-07-25 02:29:28 +01:00
committed by GitHub
parent f804da4b45
commit 5cf3dce36e
9 changed files with 42 additions and 25 deletions

View File

@@ -1,5 +1,6 @@
"""Test the HTML builder and check output against XPath."""
import hashlib
import os
import re
from itertools import chain, cycle
@@ -12,7 +13,6 @@ from html5lib import HTMLParser
from sphinx.builders.html import validate_html_extra_path, validate_html_static_path
from sphinx.errors import ConfigError
from sphinx.testing.util import strip_escseq
from sphinx.util import md5
from sphinx.util.inventory import InventoryFile
FIGURE_CAPTION = ".//figure/figcaption/p"
@@ -474,9 +474,9 @@ def test_html_download(app):
@pytest.mark.sphinx('html', testroot='roles-download')
def test_html_download_role(app, status, warning):
app.build()
digest = md5(b'dummy.dat').hexdigest()
digest = hashlib.md5(b'dummy.dat', usedforsecurity=False).hexdigest()
assert (app.outdir / '_downloads' / digest / 'dummy.dat').exists()
digest_another = md5(b'another/dummy.dat').hexdigest()
digest_another = hashlib.md5(b'another/dummy.dat', usedforsecurity=False).hexdigest()
assert (app.outdir / '_downloads' / digest_another / 'dummy.dat').exists()
content = (app.outdir / 'index.html').read_text(encoding='utf8')