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 = ("""#include """
- """<stdio.h>""")
+ if pygments_version < (2, 10, 0):
+ expected_expr = ("""#include """
+ """<stdio.h>""")
+ else:
+ expected_expr = ("""#include"""
+ """ """
+ """<stdio.h>""")
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 = ("""#include """
- """<STDIO.H>""")
+ if pygments_version < (2, 10, 0):
+ expected_expr = ("""#include """
+ """<STDIO.H>""")
+ else:
+ expected_expr = ("""#include"""
+ """ """
+ """<STDIO.H>""")
assert_count(expected_expr, result, 1)
# literal block in list item should be translated