Merge pull request #8205 from tk0miya/test_with_pygments270

Fix our test failed with pygments-2.7.0
This commit is contained in:
Takeshi KOMIYA 2020-09-13 10:50:50 +09:00 committed by GitHub
commit b5dc3adf66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,8 +10,10 @@
import os import os
import re import re
from distutils.version import LooseVersion
from itertools import cycle, chain from itertools import cycle, chain
import pygments
import pytest import pytest
from html5lib import HTMLParser from html5lib import HTMLParser
@ -1591,4 +1593,8 @@ def test_html_codeblock_linenos_style_inline(app):
app.build() app.build()
content = (app.outdir / 'index.html').read_text() content = (app.outdir / 'index.html').read_text()
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 assert '<span class="lineno">1 </span>' in content