diff options
author | Adam Turner <9087854+aa-turner@users.noreply.github.com> | 2023-01-01 19:17:24 +0000 |
---|---|---|
committer | Adam Turner <9087854+aa-turner@users.noreply.github.com> | 2023-01-01 19:17:24 +0000 |
commit | 1e900a26e8831470eb5777de44e5532c18af3f62 (patch) | |
tree | 625c57bccbe3730dbade62a942b28acd78ec29b6 | |
parent | bd71d6e85aaa9ff2f0bb288897af3436983251b6 (diff) | |
parent | 965768bfda2a00ba6466cdb12a7a46efdce47023 (diff) | |
download | sphinx-git-1e900a26e8831470eb5777de44e5532c18af3f62.tar.gz |
Merge branch '6.0.x'
-rw-r--r-- | pyproject.toml | 2 | ||||
-rw-r--r-- | tests/test_ext_viewcode.py | 27 | ||||
-rw-r--r-- | tests/test_intl.py | 11 |
3 files changed, 29 insertions, 11 deletions
diff --git a/pyproject.toml b/pyproject.toml index 1f060208d..dfe93108d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,7 +62,7 @@ dependencies = [ "sphinxcontrib-serializinghtml>=1.1.5", "sphinxcontrib-qthelp", "Jinja2>=3.0", - "Pygments>=2.12", + "Pygments>=2.13", "docutils>=0.18,<0.20", "snowballstemmer>=2.0", "babel>=2.9", diff --git a/tests/test_ext_viewcode.py b/tests/test_ext_viewcode.py index 7750b8da0..6d443d1c6 100644 --- a/tests/test_ext_viewcode.py +++ b/tests/test_ext_viewcode.py @@ -2,6 +2,7 @@ import re +import pygments import pytest @@ -31,14 +32,24 @@ def test_viewcode(app, status, warning): result = (app.outdir / '_modules/spam/mod1.html').read_text(encoding='utf8') result = re.sub('<span class=".*?">', '<span>', result) # filter pygments classes - assert ('<div class="viewcode-block" id="Class1"><a class="viewcode-back" ' - 'href="../../index.html#spam.Class1">[docs]</a>' - '<span>@decorator</span>\n' - '<span>class</span> <span>Class1</span>' - '<span>(</span><span>object</span><span>):</span>\n' - ' <span>"""</span>\n' - '<span> this is Class1</span>\n' - '<span> """</span></div>\n') in result + if pygments.__version__ >= '2.14.0': + assert ('<div class="viewcode-block" id="Class1"><a class="viewcode-back" ' + 'href="../../index.html#spam.Class1">[docs]</a>' + '<span>@decorator</span>\n' + '<span>class</span> <span>Class1</span>' + '<span>(</span><span>object</span><span>):</span>\n' + '<span> </span><span>"""</span>\n' + '<span> this is Class1</span>\n' + '<span> """</span></div>\n') in result + else: + assert ('<div class="viewcode-block" id="Class1"><a class="viewcode-back" ' + 'href="../../index.html#spam.Class1">[docs]</a>' + '<span>@decorator</span>\n' + '<span>class</span> <span>Class1</span>' + '<span>(</span><span>object</span><span>):</span>\n' + ' <span>"""</span>\n' + '<span> this is Class1</span>\n' + '<span> """</span></div>\n') in result @pytest.mark.sphinx('epub', testroot='ext-viewcode') diff --git a/tests/test_intl.py b/tests/test_intl.py index efe6c9bce..07dfe8be3 100644 --- a/tests/test_intl.py +++ b/tests/test_intl.py @@ -6,6 +6,7 @@ Runs the text builder in the test root. import os import re +import pygments import pytest from babel.messages import mofile, pofile from babel.messages.catalog import Catalog @@ -1104,8 +1105,11 @@ def test_additional_targets_should_not_be_translated(app): expected_expr = ("""<span class="n">literal</span>""" """<span class="o">-</span>""" """<span class="n">block</span>\n""" - """<span class="k">in</span> """ + """<span class="k">in</span>""" + """<span class="w"> </span>""" """<span class="n">list</span>""") + if pygments.__version__ < '2.14.0': + expected_expr = expected_expr.replace("""<span class="w"> </span>""", ' ') assert_count(expected_expr, result, 1) # doctest block should not be translated but be highlighted @@ -1179,8 +1183,11 @@ def test_additional_targets_should_be_translated(app): expected_expr = ("""<span class="no">LITERAL</span>""" """<span class="o">-</span>""" """<span class="no">BLOCK</span>\n""" - """<span class="no">IN</span> """ + """<span class="no">IN</span>""" + """<span class="w"> </span>""" """<span class="no">LIST</span>""") + if pygments.__version__ < '2.14.0': + expected_expr = expected_expr.replace("""<span class="w"> </span>""", ' ') assert_count(expected_expr, result, 1) # doctest block should not be translated but be highlighted |