summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-09-13 09:16:32 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-09-13 10:42:07 +0900
commit85b24a2e88ea71edc728aff3b078d34c2f374f06 (patch)
treee0a69e1d6f2386f92a773ee36ce8edf9ceebd96b
parentfabe685638c7f8fa24b3b0a44ac264cff5f1d160 (diff)
downloadsphinx-git-85b24a2e88ea71edc728aff3b078d34c2f374f06.tar.gz
Fix our test failed with pygments-2.7.0
Since pygments-2.7.0, it has changed the style of output HTML. That makes our test broken. This fixes it to pass with new pygments.
-rw-r--r--tests/test_build_html.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/test_build_html.py b/tests/test_build_html.py
index e949f1157..1efc6c14a 100644
--- a/tests/test_build_html.py
+++ b/tests/test_build_html.py
@@ -10,8 +10,10 @@
import os
import re
+from distutils.version import LooseVersion
from itertools import cycle, chain
+import pygments
import pytest
from html5lib import HTMLParser
@@ -1591,4 +1593,8 @@ def test_html_codeblock_linenos_style_inline(app):
app.build()
content = (app.outdir / 'index.html').read_text()
- assert '<span class="lineno">1 </span>' in content
+ pygments_version = tuple(LooseVersion(pygments.__version__).version)
+ if pygments_version > (2, 7):
+ assert '<span class="linenos">1</span>' in content
+ else:
+ assert '<span class="lineno">1 </span>' in content