From 84bf048c914292701e532ebf3743f49b1f076130 Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Thu, 9 Mar 2023 09:51:20 +0100 Subject: [PATCH] Fix test failures - fix test failures related to Babel 2.12 - remove the tests that required setuptools in the environment --- fix-tests-with-babel-2.12.patch | 48 +++++++++++++++++++++++++++++++++ python-sphinx.spec | 16 ++++++++++- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 fix-tests-with-babel-2.12.patch diff --git a/fix-tests-with-babel-2.12.patch b/fix-tests-with-babel-2.12.patch new file mode 100644 index 0000000..e1992f2 --- /dev/null +++ b/fix-tests-with-babel-2.12.patch @@ -0,0 +1,48 @@ +From c5641702b552d71bc99c1ba3b45073488a30d398 Mon Sep 17 00:00:00 2001 +From: Adam Turner <9087854+aa-turner@users.noreply.github.com> +Date: Sun, 5 Mar 2023 13:32:37 +0000 +Subject: [PATCH] Update tests for Babel 2.12 (CLDR 42) + +--- + tests/test_util_i18n.py | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/tests/test_util_i18n.py b/tests/test_util_i18n.py +index e52e27671d8..7be6f3e779a 100644 +--- a/tests/test_util_i18n.py ++++ b/tests/test_util_i18n.py +@@ -4,12 +4,15 @@ + import os + import warnings + ++import babel + import pytest + from babel.messages.mofile import read_mo + + from sphinx.errors import SphinxError + from sphinx.util import i18n + ++BABEL_VERSION = tuple(map(int, babel.__version__.split('.'))) ++ + + def test_catalog_info_for_file_and_path(): + cat = i18n.CatalogInfo('path', 'domain', 'utf-8') +@@ -78,10 +81,16 @@ def test_format_date(): + format = '%x' + assert i18n.format_date(format, date=datet, language='en') == 'Feb 7, 2016' + format = '%X' +- assert i18n.format_date(format, date=datet, language='en') == '5:11:17 AM' ++ if BABEL_VERSION >= (2, 12): ++ assert i18n.format_date(format, date=datet, language='en') == '5:11:17\u202fAM' ++ else: ++ assert i18n.format_date(format, date=datet, language='en') == '5:11:17 AM' + assert i18n.format_date(format, date=date, language='en') == 'Feb 7, 2016' + format = '%c' +- assert i18n.format_date(format, date=datet, language='en') == 'Feb 7, 2016, 5:11:17 AM' ++ if BABEL_VERSION >= (2, 12): ++ assert i18n.format_date(format, date=datet, language='en') == 'Feb 7, 2016, 5:11:17\u202fAM' ++ else: ++ assert i18n.format_date(format, date=datet, language='en') == 'Feb 7, 2016, 5:11:17 AM' + assert i18n.format_date(format, date=date, language='en') == 'Feb 7, 2016' + + # timezone diff --git a/python-sphinx.spec b/python-sphinx.spec index 5455f7d..fd4d0fe 100644 --- a/python-sphinx.spec +++ b/python-sphinx.spec @@ -28,7 +28,7 @@ Name: python-sphinx #global prerel ... %global upstream_version %{general_version}%{?prerel} Version: %{general_version}%{?prerel:~%{prerel}} -Release: 3%{?dist} +Release: 4%{?dist} Epoch: 1 Summary: Python documentation generator @@ -50,6 +50,10 @@ Patch1: sphinx-test_theming.diff # https://github.com/sphinx-doc/sphinx/commit/965768bfda2a00ba6 Patch2: fix-tests-with-pygments-2.14.patch +# Backported upstream commit ensures compatibility with Babel 2.12 +# https://github.com/sphinx-doc/sphinx/commit/c5641702b +Patch3: fix-tests-with-babel-2.12.patch + BuildArch: noarch BuildRequires: make @@ -254,6 +258,12 @@ dos2unix -k ./sphinx/themes/basic/static/jquery.js rm tests/test_ext_imgconverter.py %endif +# Remove the tests that rely on setuptools +# https://github.com/sphinx-doc/sphinx/commit/44326fe2476db44e8c2a60d9326c9c3ac2865c03 +rm -r tests/roots/test-setup/ +rm tests/roots/test-theming/{MANIFEST.in,setup.py} +rm tests/test_setup_command.py + %generate_buildrequires %pyproject_buildrequires -r %{?with_tests:-x test} @@ -364,6 +374,10 @@ mkdir %{buildroot}%{python3_sitelib}/sphinxcontrib %changelog +* Thu Mar 09 2023 Karolina Surma - 1:5.3.0-4 +- Fix tests related to missing setuptools and Babel 2.12 +- Fixes rhbz#2176685 + * Tue Jan 31 2023 Karolina Surma - 1:5.3.0-3 - Fix tests with python-pygments 2.14+