summaryrefslogtreecommitdiff
path: root/tests/test_build_html.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_build_html.py')
-rw-r--r--tests/test_build_html.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/test_build_html.py b/tests/test_build_html.py
index 2e9a43f51..106ad0470 100644
--- a/tests/test_build_html.py
+++ b/tests/test_build_html.py
@@ -10,13 +10,13 @@
import os
import re
-from distutils.version import LooseVersion
from itertools import chain, cycle
from unittest.mock import ANY, call, patch
import pygments
import pytest
from html5lib import HTMLParser
+from packaging import version
from sphinx.builders.html import validate_html_extra_path, validate_html_static_path
from sphinx.errors import ConfigError
@@ -30,6 +30,9 @@ else:
FIGURE_CAPTION = ".//figure/figcaption/p"
+PYGMENTS_VERSION = version.parse(pygments.__version__).release
+
+
ENV_WARNINGS = """\
%(root)s/autodoc_fodder.py:docstring of autodoc_fodder.MarkupError:\\d+: \
WARNING: Explicit markup ends without a blank line; unexpected unindent.
@@ -1576,8 +1579,7 @@ def test_html_codeblock_linenos_style_table(app):
app.build()
content = (app.outdir / 'index.html').read_text()
- pygments_version = tuple(LooseVersion(pygments.__version__).version)
- if pygments_version >= (2, 8):
+ if PYGMENTS_VERSION >= (2, 8):
assert ('<div class="linenodiv"><pre><span class="normal">1</span>\n'
'<span class="normal">2</span>\n'
'<span class="normal">3</span>\n'
@@ -1592,8 +1594,7 @@ def test_html_codeblock_linenos_style_inline(app):
app.build()
content = (app.outdir / 'index.html').read_text()
- pygments_version = tuple(LooseVersion(pygments.__version__).version)
- if pygments_version > (2, 7):
+ if PYGMENTS_VERSION > (2, 7):
assert '<span class="linenos">1</span>' in content
else:
assert '<span class="lineno">1 </span>' in content