diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-08-18 01:50:08 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-08-19 23:26:42 +0900 |
commit | bde6c8d2effc56dc8b9098abee796167f972c306 (patch) | |
tree | 8a674212cbfa45d3e0f94adb51a76b4c4fc3947a | |
parent | e3a8ee9fcf36d48db6b28f2cd73c1bfe90bd9ae3 (diff) | |
download | sphinx-git-bde6c8d2effc56dc8b9098abee796167f972c306.tar.gz |
Fix test: Tests has been broken with pygments-2.10+
-rw-r--r-- | tests/test_intl.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/test_intl.py b/tests/test_intl.py index 7791b4aee..30beb1135 100644 --- a/tests/test_intl.py +++ b/tests/test_intl.py @@ -12,6 +12,7 @@ import os import re +import pygments import pytest from babel.messages import mofile, pofile from babel.messages.catalog import Catalog @@ -30,6 +31,8 @@ sphinx_intl = pytest.mark.sphinx( }, ) +pygments_version = tuple(int(v) for v in pygments.__version__.split('.')) + def read_po(pathname): with pathname.open() as f: @@ -1060,8 +1063,13 @@ def test_additional_targets_should_not_be_translated(app): assert_count(expected_expr, result, 1) # C code block with lang should not be translated but be *C* highlighted - expected_expr = ("""<span class="cp">#include</span> """ - """<span class="cpf"><stdio.h></span>""") + if pygments_version < (2, 10, 0): + expected_expr = ("""<span class="cp">#include</span> """ + """<span class="cpf"><stdio.h></span>""") + else: + expected_expr = ("""<span class="cp">#include</span>""" + """<span class="w"> </span>""" + """<span class="cpf"><stdio.h></span>""") assert_count(expected_expr, result, 1) # literal block in list item should not be translated @@ -1138,8 +1146,13 @@ def test_additional_targets_should_be_translated(app): assert_count(expected_expr, result, 1) # C code block with lang should be translated and be *C* highlighted - expected_expr = ("""<span class="cp">#include</span> """ - """<span class="cpf"><STDIO.H></span>""") + if pygments_version < (2, 10, 0): + expected_expr = ("""<span class="cp">#include</span> """ + """<span class="cpf"><STDIO.H></span>""") + else: + expected_expr = ("""<span class="cp">#include</span>""" + """<span class="w"> </span>""" + """<span class="cpf"><STDIO.H></span>""") assert_count(expected_expr, result, 1) # literal block in list item should be translated |