From 44ed368a82c3878b25f64bc5c2d474e03fe51ed6a99e3ae3c26bd18cbd7564b1 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Wed, 4 Jan 2023 06:27:36 +0000 Subject: [PATCH] Accepting request 1046681 from home:marxin:branches:devel:languages:python - Add pygments-2.14.patch in order to fix Pygments tests after the 2.14 release. OBS-URL: https://build.opensuse.org/request/show/1046681 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Sphinx?expand=0&rev=225 --- pygments-2.14.patch | 110 ++++++++++++++++++++++++++++++++++++++++++ python-Sphinx.changes | 6 +++ python-Sphinx.spec | 3 +- 3 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 pygments-2.14.patch diff --git a/pygments-2.14.patch b/pygments-2.14.patch new file mode 100644 index 0000000..c482420 --- /dev/null +++ b/pygments-2.14.patch @@ -0,0 +1,110 @@ +From 965768bfda2a00ba6466cdb12a7a46efdce47023 Mon Sep 17 00:00:00 2001 +From: Adam Turner <9087854+aa-turner@users.noreply.github.com> +Date: Sun, 1 Jan 2023 19:17:03 +0000 +Subject: [PATCH] Fix tests for Pygments 2.14 + +Pygments 2.14 was released on 01/01/2023 [0] + +[0]: https://pygments.org/docs/changelog/#version-2-14-0 +--- + pyproject.toml | 2 +- + tests/test_ext_viewcode.py | 27 +++++++++++++++++++-------- + tests/test_intl.py | 11 +++++++++-- + 3 files changed, 29 insertions(+), 11 deletions(-) + +diff --git a/pyproject.toml b/pyproject.toml +index 8757572f6e7..23092f302dc 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 7750b8da055..6d443d1c6d7 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('', '', result) # filter pygments classes +- assert ('
[docs]' +- '@decorator\n' +- 'class Class1' +- '(object):\n' +- ' """\n' +- ' this is Class1\n' +- ' """
\n') in result ++ if pygments.__version__ >= '2.14.0': ++ assert ('
[docs]' ++ '@decorator\n' ++ 'class Class1' ++ '(object):\n' ++ ' """\n' ++ ' this is Class1\n' ++ ' """
\n') in result ++ else: ++ assert ('
[docs]' ++ '@decorator\n' ++ 'class Class1' ++ '(object):\n' ++ ' """\n' ++ ' this is Class1\n' ++ ' """
\n') in result + + + @pytest.mark.sphinx('epub', testroot='ext-viewcode') +diff --git a/tests/test_intl.py b/tests/test_intl.py +index efe6c9bce93..07dfe8be3f4 100644 +--- a/tests/test_intl.py ++++ b/tests/test_intl.py +@@ -6,6 +6,7 @@ + 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 = ("""literal""" + """-""" + """block\n""" +- """in """ ++ """in""" ++ """ """ + """list""") ++ if pygments.__version__ < '2.14.0': ++ expected_expr = expected_expr.replace(""" """, ' ') + 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 = ("""LITERAL""" + """-""" + """BLOCK\n""" +- """IN """ ++ """IN""" ++ """ """ + """LIST""") ++ if pygments.__version__ < '2.14.0': ++ expected_expr = expected_expr.replace(""" """, ' ') + assert_count(expected_expr, result, 1) + + # doctest block should not be translated but be highlighted diff --git a/python-Sphinx.changes b/python-Sphinx.changes index 2b46469..613c801 100644 --- a/python-Sphinx.changes +++ b/python-Sphinx.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jan 4 05:56:10 UTC 2023 - Martin Liška + +- Add pygments-2.14.patch in order to fix Pygments tests + after the 2.14 release. + ------------------------------------------------------------------- Sat Dec 31 09:06:47 UTC 2022 - Martin Liška diff --git a/python-Sphinx.spec b/python-Sphinx.spec index 817ab37..8749065 100644 --- a/python-Sphinx.spec +++ b/python-Sphinx.spec @@ -1,7 +1,7 @@ # # spec file # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -42,6 +42,7 @@ Source3: requests.inv Source4: readthedocs.inv Source5: update-intersphinx.sh Source99: python-Sphinx.keyring +Patch0: pygments-2.14.patch BuildRequires: %{python_module base} BuildRequires: %{python_module flit-core} BuildRequires: %{python_module pip}