Fix tests with python-pygments >= 2.10
This commit is contained in:
parent
924f1b1e38
commit
cc7f8dfbf3
62
fix-tests-with-pygments-210.patch
Normal file
62
fix-tests-with-pygments-210.patch
Normal file
@ -0,0 +1,62 @@
|
||||
From 06ec5b027d01e8f7717e4687f89f335e83545ff9 Mon Sep 17 00:00:00 2001
|
||||
From: Takeshi KOMIYA <i.tkomiya@gmail.com>
|
||||
Date: Wed, 18 Aug 2021 01:50:08 +0900
|
||||
Subject: [PATCH] Fix test: Tests has been broken with pygments-2.10+
|
||||
|
||||
---
|
||||
tests/test_intl.py | 21 +++++++++++++++++----
|
||||
1 file changed, 17 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/tests/test_intl.py b/tests/test_intl.py
|
||||
index 7791b4aeed5..e9e7ee9e24b 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 @@
|
||||
},
|
||||
)
|
||||
|
||||
+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
|
@ -28,7 +28,7 @@ Name: python-sphinx
|
||||
#global prerel ...
|
||||
%global upstream_version %{general_version}%{?prerel}
|
||||
Version: %{general_version}%{?prerel:~%{prerel}}
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Epoch: 1
|
||||
Summary: Python documentation generator
|
||||
|
||||
@ -47,6 +47,9 @@ Patch1: sphinx-test_theming.diff
|
||||
# `types.Union` was renamed to `types.UnionType` on the HEAD of Python 3.10
|
||||
# (refs: python/cpython#27342). Afterwars, sphinx-build crashes because of ImportError
|
||||
Patch2: rename-types-Union-to-types-UnionType.patch
|
||||
# Fix test failures with python-pygments 2.10+
|
||||
# https://github.com/sphinx-doc/sphinx/pull/9557
|
||||
Patch3: fix-tests-with-pygments-210.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
@ -368,6 +371,9 @@ mkdir %{buildroot}%{python3_sitelib}/sphinxcontrib
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Aug 18 2021 Karolina Surma <ksurma@redhat.com> - 1:4.1.2-2
|
||||
- Patch python-sphinx to work with python-pygments >=2.10
|
||||
|
||||
* Mon Aug 02 2021 Karolina Surma <ksurma@redhat.com> - 1:4.1.2-1
|
||||
- Update to 4.1.2
|
||||
- Fixes rhbz#1979326
|
||||
|
Loading…
Reference in New Issue
Block a user